Reputation: 967
I want to go from www.site.com/page.php?url=string.html
to www.site.com/string.html
My .htaccess looks like this:
RewriteEngine On
RewriteRule ^([a-zA-Z0-9-/]+).html$ page.php?url=$1
RewriteRule ^([a-zA-Z0-9-/]+).html/$ page.php?url=$1
But it does not do anything.
Upvotes: 2
Views: 623
Reputation: 80629
Try the following rewrites:
RewriteEngine On
RewriteCond %{THE_REQUEST} ^GET\ /cms/page\.php\?url=([^\s&]+) [NC]
RewriteRule ^page\.php$ /%1? [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*\.html$ /cms/page.php?url=$0 [QSA,L]
Since the page is inside /cms
directory, updated the rules to reflect the same.
Upvotes: 1