user1432124
user1432124

Reputation:

rewrite rule for changing url

What is the rewrite rule for changing the url if an user types

http://localhost/website/cool

Then it should be changed to

http://localhost/website/save.php?id=cool

Upvotes: 0

Views: 140

Answers (2)

CodeCaster
CodeCaster

Reputation: 151594

This should do:

RewriteEngine On
RewriteRule ^(.*)$ save.php?id=$1

Upvotes: 2

Jon Lin
Jon Lin

Reputation: 143886

Sorry, can't format code in a commet. This is to answer the question:

May you please tell me what is RewriteCond

Something like this:

RewriteEngine On
RewriteCond %{REQUEST_URI} !/save.php
RewriteRule ^(.*)$ save.php?id=$1

If the URI doesn't have /save.php in it, then it will rewrite.

Upvotes: 1

Related Questions