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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.