我是否可以编写任何规则以使对图像文件夹的所有请求指向一个文件夹。我正在处理很多链接,所以我不想把../
例如:http://hostingxtreme.com/ajax/images/logo.png。
应该 http://hostingxtreme.com/images/logo.png
谢谢
这里是我正在使用的代码
Dosent好像在工作!
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>
答案 0 :(得分: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]
答案 1 :(得分: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