开发者

What is wrong with these rewrite rules

开发者 https://www.devze.com 2023-03-24 17:05 出处:网络
What is wrong with this code, I thought it was working but it appears not to be now, any help? <IfModule mod_rewrite.c>

What is wrong with this code, I thought it was working but it appears not to be now, any help?

   <IfModule mod_rewrite.c> 
    RewriteEngine On 
    RewriteCond %{HTTP_HOST} ^forum.ohmsgaming.com$ [OR] 
    RewriteCond %{HTTP_HOST} ^www.forum.ohmsgaming.com$
    Re开发者_开发知识库writeRule ^/?$ "http\:\/\/ohmsgaming\.com\/community\/forum\/" [R=301,L] 
    </IfModule> 

    <IfModule mod_rewrite.c> 
    RewriteCond %{HTTP_HOST} ^outhousemouse.com$ [OR] 
    RewriteCond %{HTTP_HOST} ^www.outhousemouse.com$ 
    RewriteRule ^/?$ "http\:\/\/ohmsgaming\.com" [R=301,L] 
    </IfModule>


You don't need to escape the RewriteRule values. That might be your problem.

Example:

RewriteRule ^/?$ http://ohmsgaming.com/community/forum/ [R=301,L]

When in doubt, turn on rewrite logging:

RewriteLog /var/log/apache2/MYDOMAIN_rewrite.log
RewriteLogLevel 5

This log can be viewed using tail -f /path/to/log, then reload the page. It will clearly list the processing going on.

Edit

I just noticed that the conditions are not escaped, they should look like:

RewriteCond %{HTTP_HOST} ^forum\.ohmsgaming\.com$
0

精彩评论

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