Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

well wat im trying to do is to remove the Question mark from the url like, im using a form and the action of it is lets say city.php depending on wat u enter on the form the url will be like http://mysite/city.php?city=newyork the thing is how can i remove the question mark from the link using .htaccess

share|improve this question
If you remove the city from the link, how will you know what it was? Are you planning on rewriting it to /newyork.php or something like /city.php/newyork? It might break caching but maybe you're thinking of <form method="POST" action="city.php">? – DerfK Oct 26 '10 at 11:13
@DerfK ummm no im not trying to use post because the link then wont be able to be bookmarked, a little more explanation: wat im trying to do is to have a dynamic .php page , how the thing works is when i click on a static image the image is send to the .php page, an the php page gets the image title and the image url and displays it on that page, and the get method builds a url with the name of the image etc in other words is like creating links on the fly... but im having dificult on removing the question mark so the link would be clean... – donvitto Oct 26 '10 at 21:21

In your .htaccess file or virtual host configuration do something like this:

RewriteEngine On
RewriteRule ^city/(.*)$ /city.php?city=$1 [P]

This will transparently proxy requests from http://mysite/city/newyork to the server as http://mysite/city.php?city=newyork.

share|improve this answer
i try this but doing this the city.php wont work it kinda hides it or doesn't send anything that was submitted... – donvitto Oct 26 '10 at 21:25
Check your log files to see what's happening. Perhaps you don't have mod_rewrite installed? Or you don't have permission to activate it from .htaccess? Or a typo? The log files will tell you how far the request is getting and what errors it encounters. – Caleb Oct 27 '10 at 7:43

I believe you are looking for URL rewriting.

share|improve this answer

Your Answer


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.