htaccess Elite

.htaccess tutorial


All times are UTC [ DST ]





Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: Very simple RewriteRule question
PostPosted: 08 Aug 2008 17:05 
Offline

Joined: 08 Aug 2008 17:00
Posts: 3
I am new to HTAccess. How do I modify this rule:

Code:
RewriteRule ^(.*)$ index.php?path=$1 [QSA,NS,L]


So that it only works when '.html' isn't in the path? I think in need [^html] somewhere in there?


Top
 Profile  
 
 Post subject: Re: Very simple RewriteRule question
PostPosted: 11 Aug 2008 04:17 
Offline

Joined: 02 Aug 2008 16:09
Posts: 6
RewriteRule ^([^\.]+)\.html$ index.php?path=$1 [NS,L,QSA]


Top
 Profile  
 
 Post subject: Re: Very simple RewriteRule question
PostPosted: 14 Aug 2008 09:28 
Offline

Joined: 08 Aug 2008 17:00
Posts: 3
Thanks for your reply Suiker but I think it's incorrect?

What happens with your rule: (both incorrect)
domain.com/test.html --> domain.com/index.php?path=test
domain.com/test --> (Page not found)

What should happen:
domain.com/test.html --> domain.com/test.html (no change)
domain.com/test --> domain.com/index.php?path=test


Top
 Profile  
 
 Post subject: Re: Very simple RewriteRule question
PostPosted: 14 Aug 2008 13:25 
Offline

Joined: 08 Aug 2008 17:00
Posts: 3
I think i've found it;

Code:
RewriteCond %{QUERY_STRING} !html&?
RewriteRule ^(.*)$ index.php?path=$1 [QSA,NS,L]


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 14 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Powered by phpBB