Jump to content
php.lv forumi

atkal mod_rewrite


yeahz

Recommended Posts

Ir jāievēro kāda noteikta secība RewriteRuļiem?

 

Lūk, mans .htaccess:

Options +Indexes
Options +FollowSymlinks
RewriteEngine On
RewriteBase /

RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?page=$1&blog_id=$2 [L] # /blog/{blog_id}/
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?page=$1&p=$2 [NC,L] # /blogs/{page_nr}/
RewriteRule ^([^/\.]+)/?$ /index.php?page=$1 [L] # main config
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?page=$1&add=$2 [L] # /add/blog/

Ja salieku visiem beigās N nevis L, tad nekas nemainās darbībā (it kā, cik saprotu, vajadzēja turpināt lasīt RewriteRulus). Visu info ieguvu no http://www.addedbytes.com/apache/url-rewriting-for-beginners/

 

Strādā tikai pirmais Rulis, pārējie vienkārši nenostrādā, ja samaina viņus vietām, ka teiksim 3. būs 1. tad strādā tikai tas kurš ir pirmais. Gribu lai strādā visi.

Link to comment
Share on other sites

Nu vairs neko nesaprotu. Ir htaccess:

RewriteRule ^([^/\.]+)/([^/\.]+)-([^/\.]+)/?$ /index.php?page=$1&blog_title=$2&blog_id=$3 [NC,L] # /blog/{blog_title}-{blog_id}/
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?page=$1&p=$2 [NC,L] # /blogs/{page_nr}/
RewriteRule ^([^/\.]+)/?$ /index.php?page=$1 [L] # main config
RewriteRule ^([^/\.]+)/([^/\.]+)/?$ /index.php?page=$1&add=$2 [L] # /add/blog/

Pirmie 3 ruļļi strādā, pēdējais nē, kaut gan tie L tur ir.

 

Bet ir 3 vienādi uzstādījumi, kas nozīmē to, ka izpildīsies tikai pirmais.

Kuri no tiem visiem ir vienādi?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...