htaccess重写包括#!

mar*_*wie 4 .htaccess mod-rewrite

召集所有.htaccess大师.我需要你的帮助!

我试图强制改写包含#!在网址中.

所以基本上我需要. http://example.com/biography

要重新写入 http://example.com/#!/biography

如果到目前为止,我的重写规则会有所不同

  RewriteEngine On
  RewriteCond %{HTTPS} !=on

  RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

  RewriteCond $1 !^(images|system|files|themes|static|favicon\.ico|robots\.txt|index\.php) [NC]
  RewriteRule ^(.*)$ /index.php/$1 [L]

我很喜欢这些东西,所以任何帮助将不胜感激.

另外...

我有这个测试做我需要它在这个htaccess测试器做的事情.http://htaccess.madewithlove.be/但是当我在我的网站上试用它时它不起作用......

RewriteCond %{REQUEST_URI} !^/#!
RewriteRule ^(.*)$ /#!/$1 [L]

没有想法为什么它不起作用?

谢谢,马克.

anu*_*ava 8

你的.htaccess是这样的:

Options +FollowSymlinks -MultiViews
RewriteEngine on

RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteRule ^(biography)/?$ /#!/$1 [R,L,NE,NC]

RewriteCond $1 !^(images|system|files|themes|static|favicon\.ico|robots\.txt|index\.php) [NC]
RewriteRule ^(.*)$ /index.php/$1 [L]
Run Code Online (Sandbox Code Playgroud)

请记住,您无法/#!在.htaccess中检查条件,因为该部分仅在浏览器中处理而不会发送到Web服务器.