0

I would like all the URLs of the following format:

mysite.com/xyz 

to display:

mysite.com/show.php?keyword=xyz 

How can I do this?

1 Answer 1

1

it should work if you put this in .htaccess (given that mod_rewrite has been enabled on your webserver and you have the right to use it):

RewriteEngine On RewriteRule ^/xyz$ /show.php?keyword=xyz [R=302,L] 
4
  • Err, I meant xyz as a variable, not literally "xyz". Does this work for a that? Commented Apr 22, 2012 at 22:22
  • Oh, I see. Is it just a regular expression? Commented Apr 22, 2012 at 22:30
  • Would RewriteRule ^/([a-zA-Z]*)$ /show.php?keyword=$1 [R=302,L] work? Commented Apr 22, 2012 at 22:30
  • 1
    Yes, you could do that, you should just care that you don't create a loop. If the catching part also matches show.php you will be bricked. Commented Apr 24, 2012 at 8:12

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.