Is it possible to rewrite apache rules in httpd.conf

How to create a simple apache rewrite rule to rewrite:

http://domain.com/vanity at http://domain.com/foo/ p>

You can also rewrite the rules in httpd.conf or should they go into the .htaccess file?

Thanks in advance.

+7
source share
3 answers

Put this on your <virtualhost> website.

 RewriteEngine On RewriteRule ^/vanity$ /foo/ [L] 

[L] will silently redirect, so the user will still see / vanity in the url. You can use [R] to force redirection.

+4
source

For httpd.conf, wrap the "Directory" tags around the rewrite rules. There is no need for .htaccess. It is generally safer to host them in your httpd.conf, so this is what I do.

+1
source

They go to httpd.conf . Check doc

0
source

All Articles