Paul Risko
asked on
Redirect Website for Mobile Devises
If I use the following script, do I have to put it on every page and update the document.location = "mobile.html" for every page?
<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "mobile.html";
}
//-->
</script>
########################## ########## ########## ####
Example would be:
Page 1
<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "mobile_page1.html";
}
//-->
</script>
Page 2
<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "mobile_page2.html";
}
//-->
</script>
Is there an easier way to redirect with .htaccess?
<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "mobile.html";
}
//-->
</script>
##########################
Example would be:
Page 1
<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "mobile_page1.html";
}
//-->
</script>
Page 2
<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "mobile_page2.html";
}
//-->
</script>
Is there an easier way to redirect with .htaccess?
No. .htaccess can't read the javascript that checks the screen size.
ASKER
How can I edit my question?
Any tips or guide on how to redirect a website to m.website.com are greatly appreciated.
Any tips or guide on how to redirect a website to m.website.com are greatly appreciated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Is there anything I need to do to let Google know m.website.com is my mobile and website.com is not the mobile? Thanks.
You can join Google Webmaster Tools and submit a sitemap containing all of your pages. https://www.wordtracker.com/academy/learn-seo/analytics/set-up-google-webmaster-tools
ASKER
Any recommendation on the simplest way to send someone to the desktop site if they are emailed a link from the mobile site? I'vd found many possible solutions to this but I'm using standard HTML for the desktop site and Joomla for the mobile. Thanks.
ASKER
Thanks.
ASKER
This method works much better:
http://wpandsuch.com/redirect-to-a-mobile-site-with-htaccess-and-set-a-cookie-to-break-redirect/
http://wpandsuch.com/redirect-to-a-mobile-site-with-htaccess-and-set-a-cookie-to-break-redirect/
ASKER
Or not :(