Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Mobile Marketing (https://www.warriorforum.com/mobile-marketing/)
-   -   mobile redirect script not working for client's site (https://www.warriorforum.com/mobile-marketing/843956-mobile-redirect-script-not-working-clients-site.html)

stranger11 14th September 2013 05:24 PM

mobile redirect script not working for client's site
 
I had someone make mobile sites for clients, but one of them is not redirecting. The rest of them are. I used the same code for all of them. Its a regular javascript code based on screen width:
<script type="text/javascript">
if(window.location.hash != '#r=off') {
if (screen.width <= 1023) {
document.location = "http://m.mysite.com";
}
}
</script>

If I go to the mobile site directly (i.e. I type in m.mysite.com) into the url, the mobile site works fine. Its not the script because I am using the script for other sites.

The guy I hired to make them stopped replying to me, so I am not sure what is wrong.

I don't know too much about coding but have edited code before so can follow instructions.

It's just weird that the problem is only with this site.

PaidAllDay 14th September 2013 08:23 PM

Re: mobile redirect script not working for client's site
 
Mobile redirects really should be done through .htaccess not javascript. Especially given that not all mobile browsers support javascript. Take a look at something like this:

NingNing Wang: How to redirect to mobile site using htaccess

stranger11 17th September 2013 08:18 PM

Re: mobile redirect script not working for client's site
 
Thanks. I don't do much coding, so I cannot find the htaccess file. Where can I find the .htaccess file? I only see the index and the different pages in the root directory.

stranger11 17th September 2013 08:32 PM

Re: mobile redirect script not working for client's site
 
I found out how to edit the .htaccess file, but it's still not redirecting. Any ideas?

Adrian John 18th September 2013 12:12 AM

Re: mobile redirect script not working for client's site
 
PM the website details and I'll set you up if you want :) or I will give you instructions.

stranger11 20th September 2013 07:28 PM

Re: mobile redirect script not working for client's site
 
Thanks Adrian,

For the record, I PMd Adrian the details, and now its fixed. See the timing of the posts yourself. He actually fixed it over 5 hours ago.


All times are GMT -6. The time now is 04:20 AM.