Jump to content

htaccess doesnt redirect? Need advice


magnetica2

Recommended Posts

Hi

 

Im trying to redirect an old search page which was domain.co.uk/?q=search but now it's domain.co.uk/search?q=search. I have the code below but nothing happens. I'm pretty sure that this is close to right but i'm not an expert with the htaccess file so any advice would be appreciated. I do use CodeIgniter but I don't believe that would affect the code.

 

 

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} ^\?q=(.*)$

RewriteRule ^\?q=(.*)/$ search?q=$1 [R=301,L]

 

 

Also just so you know I am using the code below to remove trailing slashes and that works fine.

 

RewriteCond %{REQUEST_FILENAME} !-f

RewriteCond %{REQUEST_FILENAME} !-d

RewriteCond %{REQUEST_URI} ^(.*)/$

RewriteRule ^(.*)/$ $1 [R=301,L]

Link to comment
https://forums.phpfreaks.com/topic/246370-htaccess-doesnt-redirect-need-advice/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.