Posts mit dem Label navigator werden angezeigt. Alle Posts anzeigen
Posts mit dem Label navigator werden angezeigt. Alle Posts anzeigen

Montag, 22. Februar 2016

How to Use 301 Redirect MobileIn Feburary 2016 22,

In Feburary 2016 22,
Open the homepage document for your website in a text or HTML editor. Place your cursor just above the '
' tag and hit 'Enter' once to create a blank line.
Copy the following code and paste it on the blank line:
Replace 'filename.html' with the name of your mobile page, relative to your site root. For example:document.location = '/m/index.html';Or:document.location = 'mobile.html';This code will redirect any device with a screen width below 699 pixels to your mobile site. You may adjust the screen width to 480 if you want to target iPhones and other Smartphones specifically or add the following function just above the '//-->' line:if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {location.replace('http://www.yoursite.com/iPhone.html');}Replace ' http://www.yoursite.com/iPhone.html' with the URL to your iPhone-optimized website.
jQuery Method
Open your homepage or header document in a text or HTML editor and verify the jQuery library has been included. If not, you will need to add it just above the '
' tag. The line should look something like this:
Replace 'www.yoursite.com' with the URL to your mobile-optimized site and your tablet-optimized site. Other redirects normally treat tablet browsers like a mobile device, which can be undesirable. For example, this redirect allows you to point iPad users to your normal site, and iPhone users to a mobile version:
mobile_url : 'm.mysite.com',tablet_url : 'www.mysite.com',
PHP Method
Open the document containing your website header, such as 'header.php' or 'index.php.' Place your cursor at the beginning of the document and hit 'Enter' to create a blank line.
Copy the following code block and paste it into the blank line:
Replace the URL after 'Location:' on the last line with the URL to your mobile-optimized page. For example:header('Location: http://www.mysite.com/mobile.php'); ?>Or:header('Location: http://m. mysite.com/'); ?>
Server-Side Method
Connect to your Web server using your hosting control panel or an FTP program. Edit the '.htaccess' file. If you are not able to edit files directly, download the file to your Desktop and open it using Notepad. If you do not have an '.htaccess' file, open Notepad and create a new document.
Paste the following code block into the file. If you're editing an existing file, paste this code at the bottom to avoid overwriting any existing rules:redirect mobile browsersRewriteCond %{HTTP_USER_AGENT} ^.
iPhone.
$RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]RewriteCond %{HTTP_USER_AGENT} ^.
BlackBerry.
$RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]RewriteCond %{HTTP_USER_AGENT} ^.
Palm.
$RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]This redirect is optimal, as it will only send devices with mobile browsers to your mobile website, leaving other devices with full-featured Web browsers alone.
Replace ' http://mobile.yourdomain.com' with the URL to your mobile-optimized page. For example:RewriteRule ^(.*)$ http://www.mysite.com/m [R=301]Save the file. If using Notepad, make sure 'All Files' is selected in the 'File Type' menu, and name the file '.htaccess' with no '.txt' extension. Upload the file to your domain's root folder.
In Feburary 2016 22,