Remove page id from url with mod_rewrite

I want to go from to

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.


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.

Need Your Help

.NET 4, how to execute dynamic vb code like windows workflow 4 does

dynamic .net-4.0 workflow-foundation workflow-foundation-4

Just curious how Windows Workflow 4 executes vb code. Can I use the same techique to execute code at run-time?

Reallocating memory via "new" in C++

c++ memory-management new-operator

Quick question regarding memory management in C++