Redirects not working alongside Dynamic URL's

Hi all, I have an issue with an OpenCart Redirect file, I am new to OpenCart and 301 redirects.

There are 2 kinds of redirect going on in the file, one is the part for the SEO friendly URLs but this site existed before and has transferred to OpenCart so the there are individual Google link redirects going on as well.

I managed to get the google redirects working by deleting the QSA from the last Redirect rule but this had other ramifications – the query strings for which page of products the user is on would then be ignored and they would be stuck on page 1.

Is there a way I can get the google links redirected to the appropriate pages and have the SEO friendly URLs on once they’re in the site.

Thank you, see below for a slightly butchered htaccess file )

Dave

P.s i’ve added a space in the url’s below because of the forum rules.

htaccess file begin*****

# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.

# 2. In your opencart directory rename htaccess.txt to .htaccess.

## For any support issues please visit: http://www. opencart.com

Options +FollowSymlinks

# Prevent Directoy listing
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "\\.(tpl|ini)">
Order deny,allow
Deny from all
</FilesMatch>

# SEO URL Settings
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

Redirect 301 /page/4534098781 http://www .uktrailerparts.co.uk/Load-Restraint-Equipment
Redirect 301 /page/4534098640 http://www. uktrailerparts.co.uk/Curtain-Tensioners
Redirect 301 /tir-cords/4534098782 http://www. uktrailerparts.co.uk/TIR-Cords-TIR-Cables-TIR-Tooling

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

htaccess file end*****

Hi Dave!

First, OpenCart has nothing to do with mod_rewrite except to use it (like PHP). From what you’ve shown, they use the same (generic) code that WordPress uses (and I suspect that you were smart enough to remove the <IfModule> wrapper WP uses to protect ID-ten-T “webmasters” - and I use that term VERY loosely!).

Without any example of your SEO URLs, I can’t comment on those, however, I doubt that the QSA would have impacted those at all.

When quoting code, please use [ code ] … [ /code ] wrappers (without the interior spaces) as the code will be preserved (without making URLs clickable) and without any problem from staff for infractions - that’s NOT infractable.

# .htaccess file begin

# 1.To use URL Alias you need to be running apache with mod_rewrite enabled.
[indent][COLOR="Magenta"]Alias has NOTHING to do with mod_rewrite!  Who came up with that comment?[/COLOR][/indent]
# 2. In your opencart directory rename htaccess.txt to .htaccess.
[indent].htaccess IS the correct filename (at least on Apache servers)[/indent]
# For any support issues please visit: http://www. opencart.com

Options +FollowSymlinks
[indent][COLOR="Magenta"]That should already be in your server's configuration file (NOT necessary here).[/COLOR][/indent]
# Prevent Directoy listing
Options -Indexes
[indent][COLOR="Magenta"]Ditto[/COLOR][/indent]
# Prevent Direct Access to files
<FilesMatch "\\.(tpl|ini)">
Order deny,allow
Deny from all
</FilesMatch>
[indent][COLOR="Magenta"]That should have included the .htaccess file - but no matter[/COLOR][/indent]

# SEO URL Settings
Redirect 301 /page/4534098781 http://www.uktrailerparts.co.uk/Load-Restraint-Equipment
Redirect 301 /page/4534098640 http://www.uktrailerparts.co.uk/Curtain-Tensioners
Redirect 301 /tir-cords/4534098782 http://www.uktrailerparts.co.uk/TIR-Cords-TIR-Cables-TIR-Tooling
[indent][COLOR="Magenta"]Moved before mod_rewrite as these are mod_alias directives, i.e., part of the Apache core so they take place before mod_rewrite.[/COLOR][/indent]

RewriteEngine On
RewriteBase /
[indent][COLOR="Magenta"]ONLY useful is you have mod_alias Redirects that must be UNdone before mod_rewrite can work on them![/COLOR][/indent]
RewriteCond &#37;{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)[COLOR="Red"]\\?*[/COLOR]$ index.php?_route_=$1 [L,QSA]
[indent][COLOR="Red"]ERROR!  I believe you're trying to access a query string here with the escaped ? because that's just NOT possible.  Because this regex makes no sense, you SHOULD be getting a parse error from mod_rewrite which SHOULD result in 500 errors.  All you're after is NOTHING or EVERYTHING for which the :kaioken: EVERYTHING :kaioken: atom is used (and the NOT file and NOT directory eliminate potential looping).[/COLOR][/indent]
# .htaccess file end

Regards,

DK