Vin*_*ent 6 apache .htaccess mod-rewrite redirect
我试图创建一个htaccess文件来重定向我的整个网站,除了一些例外,但我不能让它工作.我需要重定向整个事物,提供特定的重定向,并排除两个页面.以下是我的非工作样本.谢谢!
RewriteCond %{REQUEST_URI} !^/events/index.html
RewriteCond %{REQUEST_URI} !^/calendar/index.html
Redirect 301 /info/faq.html http://mynewsite.com/my-page
Redirect 301 / http://mynewsite.com
Run Code Online (Sandbox Code Playgroud)
Tim*_*one 17
您试图混合mod_rewrite使用mod_alias,但RewriteCond语句不能对语句进行条件限制Redirect,因为它们不是来自同一模块.
我相信你想要更像这样的东西,如果我正确理解你想要完成的事情:
RewriteEngine On
RewriteCond %{REQUEST_URI} !=/events/index.html
RewriteCond %{REQUEST_URI} !=/calendar/index.html
RewriteCond %{REQUEST_URI} !=/info/faq.html
RewriteRule ^.*$ http://mynewsite.com/$0 [R=301,L]
Redirect 301 /info/faq.html http://mynewsite.com/my-page
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
17147 次 |
| 最近记录: |