X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (X-Cart 5) (https://forum.x-cart.com/forumdisplay.php?f=56)
-   -   Unable to get an htaccess redirect to work? (https://forum.x-cart.com/showthread.php?t=73622)

Salty 02-23-2016 06:53 AM

Unable to get an htaccess redirect to work?
 
Hi guys,

I have my store setup under /shop and since I no longer want to use a cover page I was trying to redirect my primary domain to the subdirectory via htaccess. However, each variation I've attempted has resulted in the store loading but giving me a Page Not Found.

As a side note to this, I have other domain redirects pointing to /shop and they work fine, it seems to only be the primary domain redirect causing this issue.

For reference, I'm using XC v5.2.13

This is the basic redirect I used:

RewriteCond %{HTTP_HOST} ^(www.)?url.com$
RewriteRule ^(/)?$ shop [L]


And I've also tried:

RewriteCond %{HTTP_HOST} ^(www.)?url.com$

RewriteCond %{REQUEST_URI} !^/shop/

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

# Change 'subfolder' to be the folder you will use for your main domain.
RewriteRule ^(.*)$ /subfolder/$1

RewriteCond %{HTTP_HOST} ^(www.)?url.com$
RewriteRule ^(/)?$ shop/ [L]



Can anyone pleeeeease help with this issue?

cflsystems 02-23-2016 06:54 AM

Re: Unable to get an htaccess redirect to work?
 
Why don't you just move the site in root instead of trying to redirect it like this?

Salty 02-23-2016 06:59 AM

Re: Unable to get an htaccess redirect to work?
 
Mostly because I expected the htaccess to be the quick and painless solution... haha

I did consider it though, was just concerned it may cause too many issues. Think that's the better option?

cflsystems 02-23-2016 07:06 AM

Re: Unable to get an htaccess redirect to work?
 
Yes move it root. No need to redirects. And SE do not like redirects like this

Triple A Racing 02-23-2016 07:47 AM

Re: Unable to get an htaccess redirect to work?
 
Quote:

Originally Posted by Salty
Mostly because I expected the htaccess to be the quick and painless solution... haha


It can be :D/ .... just depends on your own Apache version / setup but it's simple to apply this:

Quote:

RedirectMatch ^/$ /shop/

That's the root to your shop sub-directory - easy.

cflsystems advise is better longterm, but if you're currently short of time...

Salty 02-23-2016 07:58 AM

Re: Unable to get an htaccess redirect to work?
 
Quote:

Originally Posted by Triple A Racing
It can be :D/ .... just depends on your own Apache version / setup but it's simple to apply this:



That's the root to your shop sub-directory - easy.

cflsystems advise is better longterm, but if you're currently short of time...

Ahhh well, thanks for the info!

I was in a bit of a rush, but I took CFL's advice and went ahead and did the transfer. It ended up being pretty painless thankfully. :mrgreen:


All times are GMT -8. The time now is 04:43 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.