You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Lance Campbell <la...@illinois.edu> on 2011/02/18 20:15:40 UTC

[users@httpd] cannot get RewriteRule for just the document root to work

Assume my site is: acme.com

The following redirects and works as expected:

RewriteCond %{HTTP_USER_AGENT} iPhone.* 
RewriteRule ^/index.html
http://test.webservices.illinois.edu/mobile.html [R,L]

So if I go to http://acme.com/index.html it redirects me to the
mobile.html page.

BUT if I go to http://acme.com/ it does not redirect me.

So I thought the following would work but it does NOT:

RewriteCond %{HTTP_USER_AGENT} iPhone.* 
RewriteRule ^/   http://test.webservices.illinois.edu/mobile.html [R,L]

How do I get just the base root to redirect?  I do not want other pages
within the site to redirect.

So http://acme.com/abc.html would NOT redirect.

-- 

Thanks,

Lance Campbell
Project Manager/Software Architect/DBA
Web Services at Public Affairs
217.333.0382






Re: [users@httpd] cannot get RewriteRule for just the document root to work

Posted by Lance Campbell <la...@illinois.edu>.
That did it!  Thanks a lot for your help.  It seems like every query I
did in Google brought back results for redirecting all content within a
domain to another domain.
-- 

Thanks,

Lance Campbell
Project Manager/Software Architect/DBA
Web Services at Public Affairs
217.333.0382




On Fri, 2011-02-18 at 14:21 -0500, Eric Covener wrote:
> > RewriteCond %{HTTP_USER_AGENT} iPhone.*
> > RewriteRule ^/   http://test.webservices.illinois.edu/mobile.html [R,L]
> 
> RewriteRule ^/$   http://test.webservices.illinois.edu/mobile.html [R,L]

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] cannot get RewriteRule for just the document root to work

Posted by Eric Covener <co...@gmail.com>.
> RewriteCond %{HTTP_USER_AGENT} iPhone.*
> RewriteRule ^/   http://test.webservices.illinois.edu/mobile.html [R,L]

RewriteRule ^/$   http://test.webservices.illinois.edu/mobile.html [R,L]

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org