0

I have the following rewrite:

RewriteRule ^/blog/(.*)$ http://www.domain.co.uk [NC,L,R=301]

But I only want it to happen if it is not a image file (.jpg, .gif, .png) or a script file (.js). Does anyone know how to set this?

(It is a wordpress blog and I want to redirect all pages but keep the scripts and images active.)

Thanks

4

2 回答 2

0

我发现我必须将位于 wordpress 文件中的 .htaccess 文件编辑为:

RewriteEngine On

RedirectMatch 301 ^/blog/$ http://www.domain.co.uk

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . / [R=301,L]
</IfModule>

# END WordPress
于 2012-09-27T13:29:47.810 回答
0
RewriteCond %{REQUEST_FILENAME} !^(.+)\.js$
RewriteCond %{REQUEST_FILENAME} !^(.+)\.png$
RewriteCond %{REQUEST_FILENAME} !^(.+)\.jpg$
RewriteCond %{REQUEST_FILENAME} !^(.+)\.jpeg$
RewriteCond %{REQUEST_FILENAME} !^(.+)\.gif$
RewriteRule ^/blog/(.+)$ http://www.domain.co.uk [NC,L,R=301]
于 2012-09-27T12:16:10.620 回答