Page 1 of 1

Setting up .htaccess for redirect, struggling....

Posted: Mon Mar 04, 2019 8:48 pm
by waghelak
Hello Guys

I need some help with redirects on .htaccess file. I am currently running SEO URLs and having issues with google trying to index my site with also .index.php which is giving errors not found link errors. Current settings is as below.

How would i force index.php to URL of co.uk. I did manage to get it working but lost access to admin pages.

Thanks

Code: Select all

RewriteBase /
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*) https://www.mysite.co.uk%{REQUEST_URI} [R=301,L,NE]
RewriteRule ^sitemap.xml$ index.php?route=extension/feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=extension/feed/google_base [L]
RewriteRule ^system/storage/(.*) index.php?route=error/not_found [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

Re: Setting up .htaccess for redirect, struggling....

Posted: Mon Mar 04, 2019 9:23 pm
by waghelak
I added the below code but lost access to admin, redirect was working as required.

Code: Select all

#RewriteCond %{THE_REQUEST} ^.*/index\.php 
#RewriteRule ^(.*)index.php$ /$1 [R=301,L]

Re: Setting up .htaccess for redirect, struggling....

Posted: Mon Mar 04, 2019 9:38 pm
by waghelak
i think i finally got it working, anyone see any issues with this?

Code: Select all

RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteCond %{REQUEST_URI} !^/admin/
RewriteCond %{REQUEST_URI} !^/administration/ 
RewriteRule ^(.*)index.php$ /$1 [R=301,L] 

Re: Setting up .htaccess for redirect, struggling....

Posted: Tue Mar 05, 2019 2:32 am
by waghelak
above seems to break other functions such as add to cart etc. arrrgghhhhh!!!!!