Question

I want to convert a url like this url/2013/08/a-very-long-description/

to something like this url/page?name=a-very-long-description

this is what i've tried thus far and fail RewriteRule ^2013/08\/(.*) url/page?name=$1 [L,R=301]

this is the result I get is url/page?name=a-very-long-description/.php

which if i could remove the /.php would work, but cant seem to wrap my head around it

other speculations in the htaccess file:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f

RewriteRule ^([^\.]+)$ $1.php [NC,L]

Was it helpful?

Solution

You have another rule that is tacking on the .php to the end. You need to make sure this rule is before that one. And change your rule to:

RewriteRule ^2013/08\/([^/]+) url/page?name=$1 [L,R=301]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top