redirect everything except index.html

New to mod_rewrite? This is a good place to start.

redirect everything except index.html

Postby dabd » Mon Oct 26, 2009 3:23 pm

Hi,

I would like to redirect everything except the index.html file but I can't get it to work with the following rules:

RewriteRule foo/services$ /somedir/foo/services/index.html [R,L]
RewriteRule foo/services/(.*) http://server:8080/someservices/$1 [P,L]

How do I redirect /foo/services to the index.html but everything else to the server:8080...

Thanks.
dabd
 
Posts: 2
Joined: Mon Oct 26, 2009 3:09 pm

Postby richardk » Tue Oct 27, 2009 11:41 am

Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^foo/services/?$ /somedir/foo/services/index.html [R,L]

RewriteCond $1 !^index\.html$
RewriteRule ^foo/services/(.+)$ http://server:8080/someservices/$1 [P,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby dabd » Tue Oct 27, 2009 1:38 pm

I'll try it thanks.
richardk wrote:Try
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^foo/services/?$ /somedir/foo/services/index.html [R,L]

RewriteCond $1 !^index\.html$
RewriteRule ^foo/services/(.+)$ http://server:8080/someservices/$1 [P,L]
dabd
 
Posts: 2
Joined: Mon Oct 26, 2009 3:09 pm


Return to Beginner's Corner

Who is online

Users browsing this forum: No registered users and 25 guests

cron