Looking for some help from an expert on writing some .htaccess rewrite rules. Here is what I'm trying to accomplish:
#) User requests Displayed to User As Actual Request to Server 1) www.example.com* example.com* example.com* 2) example.com example.com example.com/index.php 3) example.com/index.php example.com example.com/index.php 4) example.com/mypage example.com/mypage example.com/index.php?p=mypage 5) m.example.com m.example.com example.com/mobile.php 6) m.example.com/index.php m.example.com example.com/mobile.php 7) m.example.com/mobile.php m.example.com example.com/mobile.php 8) m.example.com/mypage m.example.com/mypage example.com/mobile.php?p=mypage
Here is what I have working so far. It takes care of lines 1, 3 and 4. As soon as I start adding the mobile stuff, I get lost.
RewriteEngine On RewriteBase / RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC] RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L] RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC] RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L] RewriteRule ^([a-z\-]+)$ /index.php?p=$1 [L]
I've spent too much time on trying to figure this out, and I just keep running into dead ends. I keep getting parts of it to work, but then other parts break. Any help would be appreciated.
Thanks!