Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

htaccess rewrite for query string

Tags:

Ok, im pretty new at this and I would really appreciate some help, thanks!

How can i rewrite this in .htaccess correctly?

So I have a query string in my url:

 /?url=contact 

All i want to do is remove the query string

 /contact 

Help? I scoured google and I'm learning the syntax right now, but the fact remains..I dont know how to do it just yet. Thanks to all

like image 263
wesside Avatar asked Aug 05 '09 03:08

wesside


People also ask

Can you redirect a query string?

Occasionally, you may need to redirect a URL that includes a query string. This will require that you use the RewriteEngine in order to have the redirect rule properly bring your viewers to the correct page.

What is rewrite rule in htaccess?

htaccess rewrite rules can be used to direct requests for one subdirectory to a different location, such as an alternative subdirectory or even the domain root. In this example, requests to http://mydomain.com/folder1/ will be automatically redirected to http://mydomain.com/folder2/.


1 Answers

This was my solution:

RewriteRule ^(.*)$ index.php?url=$1 [L,QSA]

like image 183
wesside Avatar answered Oct 18 '22 06:10

wesside