Htaccess Clean Url重写不起作用

时间:2014-04-13 19:47:24

标签: apache .htaccess mod-rewrite

请你看一下,告诉我这里做错了什么?我正在尝试删除动态网址。

我对htaccess不是很好,所以请放轻松:)

这就是问题所在:

# Remove dynamic URLS #
Options +FollowSymLinks
RewriteEngine on

RewriteRule /title/(.*)\.html post?title=$1

# End Remove #

这是整个htaccess文件。

# Begin hotlink protection #
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://webawwards.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.webawwards.com/.*$ [NC]
RewriteRule .(gif|jpg|png)$ - [F]
# End hotlink protection #


ErrorDocument 404 /404.php

# THIS IS WHAT I HAVE SO FAR  # 
# Remove dynamic URLS #
Options +FollowSymLinks
RewriteEngine on
RewriteRule /title/(.*)\.html post?title=$1

# End Remove #


RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
# Remove white space and replace with - #
RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+([^%20]*)%20([^\s]*) [NC]
RewriteRule ^ /%1-%2 [L,NE,R]
# End Remove space #

绝对没有任何反应。网址没有变化。顺便说一句,贝娄是我的网址,也是我想要实现的目标。

当前网址:http://www.webawwards.com/blog/post?title=Ecommerce-Web-Design-Inspiration-2014

希望实现:http://www.webawwards.com/blog/Ecommerce-Web-Design-Inspiration-2014.html

1 个答案:

答案 0 :(得分:0)

以下规则将从

重写

http://www.webawwards.com/blog/Ecommerce-Web-Design-Inspiration-2014.htmlhttp://www.webawwards.com/blog/post?title=Ecommerce-Web-Design-Inspiration-2014

RewriteRule ^blog/([a-z0-9A-Z-]+)\.html$ blog/post.php?title=$1 [NC,L]