URL重写:替换" /"与"#"在类别名称之后

时间:2014-05-25 14:47:59

标签: .htaccess url-rewriting

任何人都可以帮我用.htaccess:

重写我的网址

http://website.com/name-of-category/title-of-the-article 需要重写 http://website.com/name-of-category#title-of-the-article

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

这样的东西?

RewriteRule ^([^/]+)/(+.)/$ /#$1 [L,R,NE]

提前谢谢!

1 个答案:

答案 0 :(得分:0)

您可以在root .htaccess文件中使用此规则:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/(.+)/$ /$1#$2 [L,R=302,NE]