开发者

Apply mod_rewrite in virtual host

I would like to rewrite url in virtual host.

Virtual directory:

htdoc/dev/ , dev.com

Syntax in .htaccess in htdoc/dev:

<IfModule mod_rewrite.c>
RewriteEngine On
Rewr开发者_运维知识库iteRule test.html$ test.php [L]
</IfModule>

I am able to rewrite test.html to test.php in localhost. However, not able to do it in virtual host. What went wrong here?


Please check that you have AllowOverride option set to All:

<VirtualHost...>
    ...
    AllowOverride All
    ...
</VirtualHost>


Needs to be done in httpd.conf in the directory section...

<Directory "/var/www/html">
    AllowOverride All
</Directory>

...if using Virtual Hosting, you'd need to add the virtual host directory as in...

<Directory "/var/www/html/virtual_host_directory">
    AllowOverride All
</Directory>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜