Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Unable to get an htaccess redirect to work?

 
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)
 
Thread Tools Search this Thread
  #1  
Old 02-23-2016, 06:53 AM
 
Salty Salty is offline
 

Member
  
Join Date: Aug 2007
Posts: 19
 

Exclamation 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?
__________________
X-Cart version 5.2.13
http://www.AdvancedGraphicsInc.com
Reply With Quote
  #2  
Old 02-23-2016, 06:54 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default 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?
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #3  
Old 02-23-2016, 06:59 AM
 
Salty Salty is offline
 

Member
  
Join Date: Aug 2007
Posts: 19
 

Default 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?
__________________
X-Cart version 5.2.13
http://www.AdvancedGraphicsInc.com
Reply With Quote
  #4  
Old 02-23-2016, 07:06 AM
  cflsystems's Avatar 
cflsystems cflsystems is offline
 

Veteran
  
Join Date: Apr 2007
Posts: 14,190
 

Default 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
__________________
Steve Stoyanov
CFLSystems.com
Web Development
Reply With Quote
  #5  
Old 02-23-2016, 07:47 AM
 
Triple A Racing Triple A Racing is offline
 

X-Wizard
  
Join Date: Jul 2008
Location: Manchester UK
Posts: 1,028
 

Default 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 .... 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...
__________________
Dev Store & Live Store XC Business 5.4.1.35
Server; Ubuntu 22.04.2 LTS (HWE 6.2.0.26.26 Kernel)) / Plesk Obsidian
Nginx 1.20.4 / Apache 2.4.52 (Ubuntu Backported) / MariaDB 10.11.4 / PHP 7.4.33
Reply With Quote
  #6  
Old 02-23-2016, 07:58 AM
 
Salty Salty is offline
 

Member
  
Join Date: Aug 2007
Posts: 19
 

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

Quote:
Originally Posted by Triple A Racing
It can be .... 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.
__________________
X-Cart version 5.2.13
http://www.AdvancedGraphicsInc.com
Reply With Quote
Reply
   X-Cart forums > X-Cart 5 > Dev Questions (X-Cart 5)


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:00 AM.

   

 
X-Cart forums © 2001-2020