Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

My site is an e-commerce site. All URLs are dynamic, like "my_domain/a.php", "my_domain/a.php?id=1", "my_domain/b.php", "my_domain/b.php?id=3", etc.

I want static URLs like "my_domain/a.html","my_domain/b.html","my_domain/c.html", "my_domain/d.html", etc.

I am little weak in the .htaccess file. What do I add to my .htaccess file o achieve that result?

share|improve this question

1 Answer 1

I've been looking for an answer similar to this question for a while now.

For something like your example, you could do:

RewriteEngine On
RewriteRule ^([^/]*)$ /testpage.php?id=$1 [L]

I found this website this morning which helps to generate these re-write rules

http://www.generateit.net/mod-rewrite/

it's output was:

The original URL:
http://mywebsite.com/testpage.php?id=1
The rewritten URL:
http://mywebsite.com/1
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.