Jump to content

How do I add a new redirect to .htaccess?


Simon Culshaw

Recommended Posts

Hello, my .htacess file looks like this today:-

<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule \.(js|css|jpeg|jpg|gif|png|ico)(\?|$) - [L,NC,R=404]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

I need to redirect users from https://www.example.com/services/scripts/<scriptname>-r<recordid> to https://www.example.com/scripts/<scriptname>-r<recordid> 

AND

I need to redirect users from https://www.example.com/services/scripts/_/<category>/<scriptname>-r<recordid> to https://www.example.com/scripts/<scriptname>-r<recordid> 

The latter has an _ (underscore) in the URL

Where abouts in the file would I add these rules? I'm assuming the order is important!

Many Thanks in advance fro your help

Link to comment
Share on other sites

https://gist.github.com/ScottPhillips/1721489#file-htaccess-L44

Presumably though, this is a permanent change so you'll want to use a 301 redirect instead of a 302.

Note though that if this is to redirect Pages database records, the software may already be able to pick up the change and perform the redirect. You might wish to test first to be sure you even need to do anything custom.

Link to comment
Share on other sites

Archived

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...