Jorge
Jorge

Reputation: 5676

clean url for htaccess

How can I convert this url

http://localhost/cms/index.php?page=register

to this

http://localhost/cms/page/register.html

Please help... I'm not that good in htaccess.

Upvotes: 1

Views: 147

Answers (2)

Love Sharma
Love Sharma

Reputation: 1999

Try this to make it work like you wish: :)

RewriteEngine on

RewriteCond %{REQUEST_FILENAME} \/cms\/index\.php
RewriteCond %{QUERY_STRING} page\=(.*)
RewriteRule (.*)$ /cms/page/%1.html

Let me know in case of any issue... :)

Upvotes: 2

Vishwanath Dalvi
Vishwanath Dalvi

Reputation: 36681

Try This

Options +FollowSymlinks
RewriteEngine on
RewriteRule ^cms/([0-9]+)-([a-z]+) http://localhost/cms/index.php?page=$1-$2 [NC]

Upvotes: 0

Related Questions