Go Back   SitePoint Forums > Forum Index > Host Your Site > Apache Configuration
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old Nov 20, 2009, 10:14   #1
ben319
SitePoint Member
 
Join Date: Nov 2009
Posts: 1
Question Mobile Mod_Rewrite Issues - Too Many Redirects

I'm redirecting the iPhone (and soon to be more mobile devices) successfully but in combination with some preexisting rewrite rules in my .htaccess file it's causing too many redirects.

The mobile site is at mydomain.com/m and from mydomain.com it's trying to go to mydomain.com/m/?page=m&page=m&page=m&page=m etc.

I'm new to mod_rewrite and any help you could offer would be great!

Thanks!

Code:
   ### REDIRECT MOBILE DEVICES
   RewriteCond %{HTTP_USER_AGENT} ^(.*iPhone.*)$
   RewriteCond %{REQUEST_URI} !^/m
   RewriteRule ^(.*)$ /m [L]

   ### OTHER REQUIRED REWRITE RULES BELOW

   ### CHECK FOR TRAILING SLASH - Will ignore files
   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_URI} !/$
   RewriteCond %{REQUEST_URI} !(.*)/$
   RewriteRule ^(.*)$ /$1/ [L,R=301]

   ### MAIN REWRITE - This will ignore directories
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteRule ^(.*)\/$ /index.php?page=$1&%{QUERY_STRING}   [L]
ben319 is offline   Reply With Quote
 

Bookmarks

Tags
mod_rewrite

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 01:51.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved