0

I've been tring for some time now with htaccess to rewrite this url

http://www.domain.com/folder/file.php?id=whatever 

to

http://www.domain.com/?id=whatever 

Any help would be much appreciated !

1
  • 1
    Why you trying to rewrite an ugly URL into a "less ugly" only instead of use the www.domain.com/whatever format? Commented Apr 17, 2011 at 20:03

2 Answers 2

5
RewriteEngine on RewriteCond %{QUERY_STRING} ^id=([0-9]+)$ RewriteRule ^$ folder/file.php?id=$1 [QSA,L] 
Sign up to request clarification or add additional context in comments.

Comments

0

Must be something like

RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^$ folder/file.php [QSA] 

look for the exact syntax urself ... also notice the QSA flag ... actually it redirects the query string from called url to actual url ... also you can not match the part after '?' ie the query string in the regex ...

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.