我有這個.htaccess
:這個重寫規則有什麼問題?
RewriteEngine On
RewriteRule ^!/(.*)$ path/to/a/file/$1 [L]
RewriteRule ^(.*)$ path/to/another/file/$1 [L]
我想在www.website.com/!/this/
形式的URL改寫爲path/to/a/file
。任何與該模式不匹配的網址都應重寫爲path/to/another/file/
。
這裏就是我試圖遠:
RewriteEngine On
RewriteRule ^!/(.*)$ path/to/a/file/$1 [L]
RewriteCond ...
RewriteRule ^(.*)$ path/to/another/file/$1 [L]
當使用上述重寫規則,我得到一個500 - 內部錯誤。
我該如何解決?
是什麼:'的RewriteCond ...'? – 2012-01-29 22:45:56
@BookOfZeus,http://wiki.apache.org/httpd/RewriteCond – Shoe 2012-01-29 23:03:08
IIRC!不是有效的URI字符。這將導致mod_rewrite在這個模式中陷入困境。 – TerryE 2012-01-30 00:01:43