简体   繁体   中英

Htaccess Clean Url rewrite not working

Could you please have a look and advise what am I doing wrong here? I'm trying to remove dynamic urls.

I'm not very good with htaccess so please take it easy :)

This is where the problem is:

# Remove dynamic URLS #
Options +FollowSymLinks
RewriteEngine on

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

# End Remove #

This is the whole htaccess file.

# 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 #

Absolutely nothing happens. No change in url. By the way bellow is my url and what I want to achieve.

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

Looking to achieve: http://www.webawwards.com/blog/Ecommerce-Web-Design-Inspiration-2014.html

Below rule will rewrite from

http://www.webawwards.com/blog/Ecommerce-Web-Design-Inspiration-2014.html to http://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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM