Author Topic: Sudirectory Redirect  (Read 15836 times)

Offline Berty

  • Newbie
  • *
  • Posts: 10
  • Karma: +2/-0
    • View Profile
Sudirectory Redirect
« on: January 06, 2015, 03:42:11 PM »
For directory organisation reasons, I naively placed my Abantecart site in a subdirectory named the same name as my domain (including fullstops).
ie: So the full website URL is now hxxp://www.mysite.com/www.mysite.com/                  (nb: "http" is modified as forum didn't allow link format)

The site works completely, but I want to use the base domain only.   I thought I could get it to use the base domain by changing the site address in the admin settings, but it doesn't seem to redirect when entering the base domain URL in admin. 

I played with .htaccess, and finally I can now TYPE the base domain and get access to the site at that same URL ... -->hxxp://www.mysite.com (and get the URL to show the same in the browser).

BUT ..... once I click on the site logo, home, categories menu, etc, the browser retrieves the site and shows the URL from the subdirectory again
ie:
 -->hxxp://www.mysite.com/www.mysite.com/   

I have wasted weeks on this now in playing with the htaccess code, but unfortunately I am no expert of htaccess and nothing seems to work.   :-[ 
Could someone please help me?


My base directory .htaccess is this:

RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} !^/www\.mysite\.com/.
RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.
RewriteRule ^(.*)$ \/www\.mysite\.com\/$1 [L]


I also have the following in the subdirectory htaccess file:

# SEO URL Settings
 RewriteEngine On
 RewriteBase /
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L]


The site only works when both complete sets of htaccess code are used.  As soon as I delete any lines of either file, no redirections are possible.
Any help would be GREATLY appreciated.  Thanks!

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4358
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Sudirectory Redirect
« Reply #1 on: January 07, 2015, 02:05:01 PM »
You need to read help manual to save yourself time.

There is #3 in htaccess manual:
Code: [Select]
# 3. Edit file .htaccess. If abantecart is installed in yourdomain/ subfolder change configuration line  RewriteBase /  to  RewriteBase /subfolder/.
# Example:  yourdomain.com/store   use RewriteBase/store/
# Important to have / at the end of the line.

In your case
RewriteBase /www.mysite.com/
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline Berty

  • Newbie
  • *
  • Posts: 10
  • Karma: +2/-0
    • View Profile
Re: Sudirectory Redirect
« Reply #2 on: January 07, 2015, 04:43:38 PM »
Thanks for reply.   I have definitely read that part of the manual over and over and anything else I possibly could.  Still no luck.
I should have added, that the SEO friendly label part of things works.  It is just the subdirectory label I can get it to cut off.

Just now, I have tried adding the extra directory name on Rewritebase /  again just as you said
ie: I tried adding both escaped and non-escaped versions before the fullstops too ....

Rewritebase /www\.mysite\.com/
and
Rewritebase /www.mysite.com/
No luck....

If I add or change to Rewritebase in the .htaccess in the subdirectory, I get server 500 errors.
If I add extra to the Rewritebase of root .htaccess, it doesn't seem to change anything (seems to ignore the addition... in fact, I can write anything as the directory name and it ignores it), but the site loads very slowly.

So SEO names work, but the site only loads and shows the base domain URL if I type it in.  Any navigation clicks and the browser goes to the full domain+subdirectory+SEOname URL still.


« Last Edit: January 08, 2015, 07:58:14 AM by Berty »

Offline Berty

  • Newbie
  • *
  • Posts: 10
  • Karma: +2/-0
    • View Profile
Re: Sudirectory Redirect
« Reply #3 on: January 08, 2015, 07:51:18 AM »
 :-\ :-\
Maybe this is not an htaccess problem anymore??? 
The SEO names are working so it seems the htaccess file(s) are doing *something* ....., but I have found the following error message in my logs .... 


"2015-01-08 4:11:06 - App Warning:  AbanteCart core v.1.1.9 Warning: Accessing store with unconfigured or unknown domain ( mysite.com/www.mysite.com/ ).
 Check setting of your store domain URL in System Settings . Loading default store configuration for now. in /home/myhostname/public_html/www.mysite.com/core/lib/config.php on line 169
"


It doesn't seem to matter what I type in the   System/Store URL   setting in admin.  It is getting ignored each time anyway.  Is there anywhere else where the URL is set? 

I am totally stuck.  Any ideas?

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4358
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Sudirectory Redirect
« Reply #4 on: January 08, 2015, 12:50:52 PM »
This is not an error. --> App Warning

Is your domain mysite.com or www.mysite.com ?
Looks like config has www.mysite.com but you use mysite.com in the browser.

You need to set redirect mysite.com to www.mysite.com in htaccess to keep it uniform.
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline Berty

  • Newbie
  • *
  • Posts: 10
  • Karma: +2/-0
    • View Profile
Re: Sudirectory Redirect
« Reply #5 on: January 09, 2015, 03:43:08 PM »
Possible, but how would I rewrite for that alongside the subdirectory redirect?

Also, where does the string from Settings>Details>Store URL get placed and used?  It seems like the value it is getting ignored value completely.   :'(

Offline Berty

  • Newbie
  • *
  • Posts: 10
  • Karma: +2/-0
    • View Profile
Re: Sudirectory Redirect
« Reply #6 on: January 16, 2015, 01:17:29 AM »
Just as feedback since this thread died without any real solution...
I gave up using a subdomain with www(dot)mydomain(dot)com after wasting too much time on it.

I ended up renaming the subdirectory so it didn't contain fullstops.  (Not what I prefer on my multisite server, but seemingly the easiest way out.)

My advice to others is DO NOT include fullstops in the subdirectory name.  You are just just asking for problems for yourself!

Offline Basara

  • Administrator
  • Hero Member
  • *****
  • Posts: 5774
  • Karma: +274/-2
    • View Profile
Re: Sudirectory Redirect
« Reply #7 on: January 16, 2015, 04:24:08 AM »
My advice to others is DO NOT include fullstops in the subdirectory name.  You are just just asking for problems for yourself!

Thank you for share solution

 

Powered by SMFPacks Social Login Mod