jimhuang
Advanced Member
Taiwan
258 Posts |
Posted - 09/17/2018 : 21:44:56
I just upgrade new version  in my root domain .htaccess is with following: IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* <Limit GET POST> order deny,allow deny from all allow from all </Limit> <Limit PUT DELETE> order deny,allow deny from all </Limit> <files .htaccess> order allow,deny deny from all </files> Options -Indexes AddDefaultCharset UTF-8 AddCharset UTF-8 .htm .html .php .css .js .woff Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] RewriteCond %{HTTPS} off RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] ----Omit---- In my two subfolder stores such as /japan and /taiwan I use search engine friendly URL. My problem is 301 redirect: xxxxx.com ---> https://xxxxxxxxx.com OK www.xxxxxcom ---> https://xxxxxx.com OK xxxx.com/shop ---> https://xxxxxx.com/shop/ OK www.xxxxxxcom/shop ---> https://xxxxx.com/shop/ OK xxxxx.com/japan ---> https://xxxx.com/japan/ Bad www.xxxxxx.com/japan ---> www.xxxxx.com/japan/ Bad xxxx.com/taiwan ---> www.xxxx.com/taiwan/ Bad www.xxxxxx.com/taiwan ---> www.xxxx.com/taiwan/ Bad Is there anything I did wrong?
|
Andy
ECT Moderator
95440 Posts |
Posted - 09/18/2018 : 01:12:36
|
jimhuang
Advanced Member
Taiwan
258 Posts |
Posted - 09/18/2018 : 01:23:47
I want they redirect to non www and with https eg. https://my-site
|
Andy
ECT Moderator
95440 Posts |
Posted - 09/18/2018 : 03:07:25
|
jimhuang
Advanced Member
Taiwan
258 Posts |
Posted - 09/18/2018 : 03:57:00
Andy, sorry! I can not find good answer in that URL.
I think the problem is related to SEO URL, because my .../shop folder using static url .php extensive (not seo url) and it works fine. The other two folders using seo url, but they didn't work.
Jim
|
jimhuang
Advanced Member
Taiwan
258 Posts |
Posted - 09/18/2018 : 23:07:42
I temporarily delete the subfolder htaccess file, then whole my site includes all subfolders url works very well. All URLs will redirect to non www with https
So I think these two htaccess files in root domain and subfolder store conflict.
Here is my root domain htaccess: RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] RewriteCond %{HTTPS} !on RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Subfoler store htaccess: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^category/([^/.]*)/?$ /japan/categories.php?cat=$1 [QSA,nc,L,B] RewriteRule ^products/([^/.]*)/?$ /japan/products.php?cat=$1 [QSA,nc,L,B] RewriteRule ^manufacturer/?$ /japan/categories.php?man=all [QSA,nc,L,B] RewriteRule ^manufacturer/([^/.]*)/?$ /japan/products.php?man=$1 [QSA,nc,L,B] RewriteRule ^([^/.]+)$ japan/proddetail.php?prod=$1 [QSA,nc,L,B] </IfModule>
Is there anyone can help me?
By the way, Andy, can you please delete all my site links in this post to avoid spam links.
Jim

|
Phil
ECT Moderator
United Kingdom
7715 Posts |
Posted - 09/19/2018 : 04:17:56
|
jimhuang
Advanced Member
Taiwan
258 Posts |
Posted - 09/19/2018 : 05:43:15
Hi, Phil
No, there is no this line because /japan folder is not a second store. It is a Japanese language store with different dtabase than main English store. In admin setting is Store URL: http://xxxxx.com/japan/ and HTTPS store URL: https://xxxxx.com/japan/
In fact, I have 4 stores: english, china, japan, taiwan Engish and China second store use same database with static php url such as product-name.php (301 redirect works well) Japan and Taiwan store use a each independent database with seo url such /japan/products/product-name (can Not redirect to no www with https)
|
Phil
ECT Moderator
United Kingdom
7715 Posts |
Posted - 09/19/2018 : 05:55:11
|
jimhuang
Advanced Member
Taiwan
258 Posts |
Posted - 09/19/2018 : 20:45:13
Hi, Phil
Where should I add it?
I add it as follws: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] RewriteRule ^category/([^/.]*)/?$ /japan/categories.php?cat=$1 [QSA,nc,L,B] RewriteRule ^products/([^/.]*)/?$ /japan/products.php?cat=$1 [QSA,nc,L,B] RewriteRule ^manufacturer/?$ /japan/categories.php?man=all [QSA,nc,L,B] RewriteRule ^manufacturer/([^/.]*)/?$ /japan/products.php?man=$1 [QSA,nc,L,B] RewriteRule ^([^/.]+)$ japan/proddetail.php?prod=$1 [QSA,nc,L,B] </IfModule>
However it not works. xxx.com/japan redirect to root domain xxx.com
Jim
Edited by - jimhuang on 09/19/2018 22:17:54
|
jimhuang
Advanced Member
Taiwan
258 Posts |
Posted - 09/20/2018 : 00:42:32
Maybe the problem came from root domain htaccess file, so can someone examine my root domain htaccess:
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti* <Limit GET POST> order deny,allow deny from all allow from all </Limit> <Limit PUT DELETE> order deny,allow deny from all </Limit>
<files .htaccess> order allow,deny deny from all </files> Options -Indexes
AddDefaultCharset UTF-8 AddCharset UTF-8 .htm .html .php .css .js .woff
Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1/$1 [R=301,L] RewriteCond %{HTTPS} !on RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L] RewriteRule ^enter.html$ https://xxxx.com/shop/ [R=301,L] RewriteRule ^fresnellens.htm$ https://xxxx.com/shop/fresnellens.php [R=301,L]
<IfModule pagespeed_module> ModPagespeed on ModPagespeedEnableFilters defer_javascript ModPagespeedEnableFilters prioritize_critical_css ModPagespeedEnableFilters combine_css ModPagespeedEnableFilters inline_javascript ModPagespeedEnableFilters remove_comments </IfModule>
# ====================================================== # Disable problematic ETag header since we are going to use Expires # ====================================================== Header unset Pragma FileETag None Header unset ETag # ====================================================== # Set Cache-Control and Expires headers # ====================================================== <FilesMatch "\.(ico|jpg|jpeg|png|gif|js|css|swf|pdf|flv|mp3)$"> <IfModule mod_expires.c> ExpiresActive on ExpiresDefault "access plus 14 days" Header set Cache-Control "public" </IfModule> </FilesMatch>
<FilesMatch "\.(html|htm|xml|txt|xsl)$"> Header set Cache-Control "max-age=7200, must-revalidate" </FilesMatch> # ----------------------------------------------------------------------- # Defining MIME types to ensure the web server actually knows about them. # ----------------------------------------------------------------------- <IfModule mod_mime.c> AddType text/css .css AddType application/javascript js AddType application/vnd.ms-fontobject eot AddType application/x-font-ttf ttf ttc AddType font/opentype otf AddType application/x-font-woff woff AddType image/svg+xml svg svgz AddEncoding gzip svgz </Ifmodule> # ====================================================== # Activate Gzip compression # ====================================================== <IfModule mod_deflate.c> AddOutputFilterByType DEFLATE text/html text/plain text/css application/json AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE text/xml application/xml text/x-component AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype <IfModule mod_setenvif.c> BrowserMatch ^Mozilla/4 gzip-only-text/html BrowserMatch ^Mozilla/4\.0[678] no-gzip BrowserMatch \bMSIE !no-gzip !gzip-only-text/html </IfModule>
<IfModule mod_headers.c> Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" env=HTTPS Header append Vary User-Agent env=!dont-vary Header set Connection keep-alive Header always set X-Content-Type-Options "nosniff" </IfModule>
</IfModule>

|
Phil
ECT Moderator
United Kingdom
7715 Posts |
Posted - 09/20/2018 : 00:51:22
In your htaccess file that's in the japan directory can you add this and see if it works? RewriteCond %{HTTP_HOST} ^(www\.yourdomain\.com)?$ RewriteRule ^(.*)$ http://yourdomain.com/japan/$1 [R=301,L] So then you would have the following: <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^(www\.yourdomain\.com)?$ RewriteRule ^(.*)$ https://yourdomain.com/japan/$1 [R=301,L] RewriteRule ^category/([^/.]*)/?$ /japan/categories.php?cat=$1 [QSA,nc,L,B] RewriteRule ^products/([^/.]*)/?$ /japan/products.php?cat=$1 [QSA,nc,L,B] RewriteRule ^manufacturer/?$ /japan/categories.php?man=all [QSA,nc,L,B] RewriteRule ^manufacturer/([^/.]*)/?$ /japan/products.php?man=$1 [QSA,nc,L,B] RewriteRule ^([^/.]+)$ japan/proddetail.php?prod=$1 [QSA,nc,L,B] </IfModule>  * Database Migrations and Conversions* * ASP to PHP Cart Conversions**Contact Us**Buy The PHP Capture Card Plugin**Rate Our Services/View Our Feedback*
|
jimhuang
Advanced Member
Taiwan
258 Posts |
Posted - 09/20/2018 : 01:13:34
Great, It is working. Phil, Thank you very much for your kind help. 
|
jimhuang
Advanced Member
Taiwan
258 Posts |
Posted - 09/20/2018 : 05:35:40
Here is another problem.
On https:// mysite.com/japan I click any product page or product detail page, then next page address bar is in https:// mysite.com/japan/product/product-name That is OK.
But I point to any product and detail page, it displays that it will link to https://www.mysite.com/japan/product-name That is wrong.
Please look at my site in profile.
|
Phil
ECT Moderator
United Kingdom
7715 Posts |
Posted - 09/20/2018 : 06:39:45
Edited by - Phil on 09/20/2018 23:17:01
|
LadyM
ECT Moderator
1721 Posts |
Posted - 09/23/2018 : 08:24:50
After using the 301 redirect in Plesk, digital downloads are now giving this error.
file_exists(): open_basedir restriction in effect.
I googled it and it seems to be the https that is causing an above root problem but how can I keep the site secure? Looks like everyone gets unsecure messages nowadays.
|
Andy
ECT Moderator
95440 Posts |
Posted - 09/23/2018 : 08:56:06
|
LadyM
ECT Moderator
1721 Posts |
Posted - 09/23/2018 : 09:05:08
I think it's server side. The htaccess file doesn't appear to have been edited. It's Servelink and I've put in a support ticket to them also so I know they will get back to me soon. I'm trying to get it back the way it was so at least the site works. There is no htaccess file in the above root folder.
Edited by - LadyM on 09/23/2018 09:06:20
|
Andy
ECT Moderator
95440 Posts |
Posted - 09/23/2018 : 09:36:24
|
LadyM
ECT Moderator
1721 Posts |
Posted - 09/23/2018 : 10:44:01
Problem solved. My fault. I had accidentally uploaded an old includes file with the incorrect path. The path was correct in the duplicate admin. Serverlink support is the best, right up there with ECT.
|
|
|