This is really frustrating for me that I have been trying to get this very basic htaccess rewrite working from hours long but couldn't do it.
I have tried following.
Options +FollowSymlinks
RewriteEngine On
RewriteBase /funshoppie/
############ Details page ################
RewriteCond %{THE_REQUEST} Deal\-details\.php\?title\=([A-Za-z0-9-]+)&id=(\d+) [NC]
RewriteRule ^%1%2? [R=301,L,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^Deals/([A-Za-z0-9-]+)/([A-Za-z0-9-]+)/?$ Deal-details.php?title=$1&id=$2 [NC,QSA,L]
can anyone tell me what wrong i am doing?
url i am trying to rewrite
http://localhost/funshoppie/Deal-details.php?title=Styling%20Tools%20-%2020%%20off&id=7
what i wish after success
http://localhost/funshoppie/Deals/Styling-Tools-20%-off/7
I have checked error logs, httpconf & ensured uncommented rewrite_module. Don't know whats causing this error.
Improper syntax being used It is quite common for a syntax error to be the reason for an . htaccess file not working. If you are familiar with how to read and configure . htaccess rules, double check your configuration.
In your browser, open /test , with the correct domain name. So, it should look like http://localhost/test or http://example.org/test . If you see the following, it works!
htaccess files follow the same syntax as the main configuration files. Since . htaccess files are read on every request, changes made in these files take immediate effect.
I cannot try this at the moment but, your regular expression is not fitting the URL:
Deal-details.php?title=Styling%20Tools%20-%2020%%20off&id=7
Based on en- and decoding this could be the following two string:
In none of the cases matches your expression:
[..] Deal-details.php\?title\=([A-Za-z0-9-]+)&id=(\d+)[..]
You are missing represented characters from your expressions like:
Try the following expression:
Deal\-details\.php\?title\=(.+)&id=(\d+)
This will match any characterafter title. Otherwise I see no problem there.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With