Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design

Magento 2, Magento Development, Customization, Extension Development and Integration, Optimization, SEO and Responsive Design
Showing posts with label htaccess. Show all posts
Showing posts with label htaccess. Show all posts

htaccess Temporary Redirect to Maintenance Page

Redirecting visitors to a maintenance page or other temporary page is most important thing while you are updating your site and don't want users to access your site. Using htaccess you can redirect your visitors to a temporary maintenance page. All you need to redirect your visitors is the following code placed in your site’s root htaccess:

htaccess Temporary Redirect to Maintenance Page

RewriteCond %{REQUEST_URI} !maintenance.html
RewriteCond %{REQUEST_FILENAME} !(styles|images).+$
RewriteCond %{REMOTE_ADDR} !^555\.555\.555\.555$
RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1$
RewriteRule (.*) /maintenance.html [R,L]

This code makes it easy to temporarily put down your website for updates.

Note: If you only want to access site, you need to change "REMOTE_ADDR" with your own IP address. Images and styles are allowed to pass through the filter as well.

Magento redirect mobile user to mobile site and get back to “full website” from mobile using htaccess

I use mobile theme for magento And now I want to create a link to view FULL SITE (if user selects they are taken to the desktop version of the site) Link to view full site, which enables the user to view the desktop site on mobile. Once the user has chosen this option they will be unable to return to the mobile site.


Change this value as in your store:
Mobile store code = mstore
Mobile website code = mobileview
Main site store code = default

#*************************

SetEnv MAGE_RUN_TYPE website
RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteCond %{QUERY_STRING} !___store=default  [NC]
RewriteCond %{HTTP_COOKIE} !track=default [NC]
RewriteRule ^ - [E=MAGE_RUN_CODE:mobileview]

RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteCond %{QUERY_STRING} ___store=default  [NC]    
RewriteRule ^ - [E=MAGE_RUN_CODE:base,CO=track:default:%{HTTP_HOST}]

RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteCond %{QUERY_STRING} !___store=mobileview  [NC]
RewriteCond %{HTTP_COOKIE} track=default [NC]
RewriteRule ^ - [E=MAGE_RUN_CODE:base]

RewriteCond %{HTTP_USER_AGENT} "android|blackberry|iphone|ipod|iemobile|opera mobile|palmos|webos|googlebot-mobile" [NC]
RewriteCond %{QUERY_STRING} ___store=mobileview  [NC]    
RewriteRule ^ - [E=MAGE_RUN_CODE:mobileview,CO=track:mstore:%{HTTP_HOST}]

#***********************

 

Copyright @ 2017 HKBlog.