Forum Moderators: phranque

Message Too Old, No Replies

Redirect all requests except this and this

         

cadillac

2:17 pm on Dec 2, 2003 (gmt 0)

10+ Year Member



I'm setting up a website that has three folders:

/xml
/xsl
/process

I would like to redirect any url (ex: www.mysite.com/new) to /process/index.php from my httpd.conf. This php page will analyse the request and create the correct output through some xml transformations. Of course I don't want to redirect if the url contains "/process/", "/xml/" or "/xsl/". I tried many patterns but I don't know how to specifiy the urls that I want to exclude from my RewriteRule.
Would be nice if someone could help me...
Many thanks

Receptional

2:57 pm on Dec 2, 2003 (gmt 0)



I am getting a techie to do this so hopefully this makes sense. This is what we are doing:

1) We put the page you are building as the default page for the error 404 file. This means it only gets called if the old page isn't found anyway.
2) We return an error 301 message "page has permanently moved here" for any page request that is in our list and redirect anything else that we may have missed to the home page (although I am sure a proper 404 message would be more helpful to the user).

Not sure we are using PHP though, I think ours is .asp but hopefully it will do the job.

cadillac

4:44 pm on Dec 2, 2003 (gmt 0)

10+ Year Member



Thanks for your suggestion. It's working but I have a problem with the logfiles. All pages are logged as 404...

jdMorgan

7:16 pm on Dec 2, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



cadillac,

Welcome to WebmasterWorld [webmasterworld.com]!

You need to place a RewriteCond ahead of your RewriteRule to exclude those paths:


RewriteCond %{REQUEST_URI} !^/(process¦x[ms]l)/$

Replace the broken pipe character "¦" with the solid one from your keyboard before use.

Ref: Introduction to mod_rewrite [webmasterworld.com]

Jim

cadillac

2:25 pm on Dec 5, 2003 (gmt 0)

10+ Year Member



Thank you jdMorgan!
I needed some time to test it but it's perfectly working now.