Innov Bee
Innov Bee

Reputation: 37

Rewrite urls in htaccess file - remove query string

I have never edited the .htaccess file before so sorry for my awful attempt

RewriteEngine On
RewriteCond %{REQUEST_URI}  ^/index\.php$
RewriteCond %{QUERY_STRING} ^id=([0-9]*)$
RewriteRule ^(.*)$ http://example.site/index/%1 [R=302,L]

I am tryting to rewrite http://ex.com/shop/?s=sa to look like http://ex.com/shop/sa

Upvotes: 0

Views: 164

Answers (1)

Abhishek Gurjar
Abhishek Gurjar

Reputation: 7476

I am assuming you are using rewriterules in shop directory and index.php is handling the data then try with below.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+?)$ index.php?s=$1 [L]

Upvotes: 1

Related Questions