Post by waghelak » Mon Mar 04, 2019 8:48 pm

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]

Newbie

Posts

Joined
Wed Apr 12, 2017 12:02 am

Post by waghelak » Mon Mar 04, 2019 9:23 pm

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]

Newbie

Posts

Joined
Wed Apr 12, 2017 12:02 am

Post by waghelak » Mon Mar 04, 2019 9:38 pm

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] 

Newbie

Posts

Joined
Wed Apr 12, 2017 12:02 am

Post by waghelak » Tue Mar 05, 2019 2:32 am

above seems to break other functions such as add to cart etc. arrrgghhhhh!!!!!

Newbie

Posts

Joined
Wed Apr 12, 2017 12:02 am
Who is online

Users browsing this forum: No registered users and 5 guests