migrate mod_rewrite from httpd.conf to .htaccess

Discuss practical ways rearrange URLs using mod_rewrite.

migrate mod_rewrite from httpd.conf to .htaccess

Postby shogo2040 » Tue Jun 23, 2009 12:28 pm

How do I migrate mod_rewrite from httpd.conf to .htaccess?

I am using xamp on windows xp.
shogo2040
 
Posts: 8
Joined: Tue May 12, 2009 10:55 pm

Postby richardk » Tue Jun 23, 2009 3:42 pm

If the RewriteRule regular expression starts with a ^/ it will need to be changed to be relative to the directory the .htaccess file is in. For example, if the rule was
Code: Select all
RewriteRule ^/abc/def/$ /abc/ghi [QSA,L]

and you are moving it to /abc/.htaccess the regular expression would need to be changed to
Code: Select all
^def/$


Any PT flags are no longer required, but leaving them will do no harm.

Redirect/rewrite loops may occur so
Code: Select all
RewriteCond %{ENV:REDIRECT_STATUS} ^$

may need to be added to some rules. (To rules that must only match requests from the browser, not requests from Apache after a rewrite.)

At the moment that's all i can think of.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

how does httpd.conf change?

Postby shogo2040 » Tue Jun 23, 2009 5:50 pm

thanks!

But how does httpd.conf change in terms of allowing the use of .htaccess?
shogo2040
 
Posts: 8
Joined: Tue May 12, 2009 10:55 pm

Postby richardk » Wed Jun 24, 2009 8:32 am

FAQ: How to enable mod_rewrite. If you have any questions or it isn't clear what to do (i wrote it a while ago) post here.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am


Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 24 guests

cron