0

Is there any rule I can write to make all requests to my image folder point up one folder. I'm dealing with a lot of links so I don't want to put ../

Eg: http://hostingxtreme.com/ajax/images/logo.png.

Should become http://hostingxtreme.com/images/logo.png

Thanks

Here the code I'm using Dosent seem to be working!
php_value register_long_arrays On
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteEngine On
RewriteRule ^/?ajax/images/logo.png$ /images/logo.png [L,R=301]
</IfModule>

4

2 回答 2

1

在文档根目录的 htaccess 文件中,添加:

Redirect 301 /ajax/images/logo.png /images/logo.png

或者,如果您需要使用 mod_rewrite:

RewriteEngine On
RewriteRule ^/?ajax/images/logo.png$ /images/logo.png [L,R=301]
于 2012-10-27T21:21:28.960 回答
0

我知道了!

RewriteCond %{REQUEST_FILENAME} !-d  
RewriteCond %{REQUEST_URI} (ajax/|ajax/.*/)images/(.*)  
RewriteRule (ajax/|ajax/.*/)images/(.*) images/$2  

RewriteCond %{REQUEST_FILENAME} !-d  
RewriteCond %{REQUEST_URI} (ajax/|ajax/.*/)stylesheets/(.*)  
RewriteRule (ajax/|ajax/.*/)stylesheets/(.*) stylesheets/$2
于 2012-10-28T06:51:59.610 回答