【发布时间】:2013-09-05 20:37:20
【问题描述】:
我希望除我的根 URL(/ 和 /index.php)以及它使用的 JS/CSS 和图像资产之外的所有 URL 都重定向到另一个 URL。所有资产都包含在 /assets 目录中
这是我目前所拥有的,但它不起作用
RewriteEngine on
RewriteRule ^(.*)\.(?!js|css)([^.]*)$ $1\.php
RewriteCond %{REQUEST_URI} !^.assets$
RewriteCond %{REQUEST_URI} !/index.php$
RewriteCond %{REQUEST_URI} !/style.php$
RewriteCond %{REQUEST_URI} !/$
RewriteRule $ http://berlincallingny.eventbrite.com [R=302,L]
我需要的规则是:
- 请勿重写任何包含“资产”的网址
- 不要重写 index.php
- 不要重写 style.php
- 不要重写根 URL
- 不要重写任何包含 .css 或 .js 的 URL
谢谢!
【问题讨论】:
-
你的意思是它没有重定向吗?还是在不应该重定向的时候重定向?
-
是的,关于所发生情况的更具描述性的信息会有所帮助。
标签: .htaccess redirect url-rewriting