Forum Moderators: phranque

Message Too Old, No Replies

excluding folder from redirect

         

elfrock

8:57 pm on Mar 5, 2007 (gmt 0)

10+ Year Member



I've redirected all my html files too php with:
RedirectMatch 301 (.*)\.html$ [domain.com$1.php...]

But I need to exclude /wordpress/ from this redirect. Can I do this without going into mod rewrite (which I have no experience of)? Could I create a more complex reg expression to filter out the wordpress folder?

Any help appreciated since wordpress is crippled by the redirect.

jdMorgan

9:15 pm on Mar 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> Can I do this without going into mod rewrite?

No, not effectively. Which is one reason that the mod_rewrite module was written.

Jim

elfrock

9:43 pm on Mar 5, 2007 (gmt 0)

10+ Year Member



Looks like I will have to grapple with the mod rewrite.

But the situation may be more complex than I thought. Wordpress has no html calls, it's all php. So I don't know why my Redirect is messing it up. But when I take that line out of my .htaccess file, wordpress works fine.

I'm a newbie at .htaccess, so apologies if I am missing the obvious.

jdMorgan

10:07 pm on Mar 5, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your directive explicitly excludes anything except .html requests, so I don't see why that should be happening either.

You might consider using the "Live HTTP Headers" extension for Firefox, and watching as it fetches a WP page -- just to verify that there are no HTTP requests as a result of WP page loads.

Jim

metro1

10:13 pm on Mar 16, 2007 (gmt 0)

10+ Year Member



I guess no one has answers but as my problem is the same I will also ask

My site used to be html but I switched to php so have the same standard htaccess

RedirectMatch 301 (.*)\.html$ [mysite.com$1.php...]

It turns out my host has a nice free stats program built in but it is all html and cannot be chaged

so an easy way around this is to simply exclude the stats directory but after a big Internet search cannot find out how to do it

it has to be a snap to do as seem to me would be a very common situation

only need some change in this first part

RedirectMatch 301 (.*)\.html$

so it says to exclude /stats/

any help appreciated

jdMorgan

12:38 am on Mar 17, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Again, this is a problem that requires the conditional-execution feature of mod_rewrite.

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim

elfrock

5:25 pm on Mar 18, 2007 (gmt 0)

10+ Year Member



Thanks for help. The solution I came up with us to put another .htaccess file in the folder that was causing problems (wordpress). It meant understanding mod-rewrite, but that was not so hard.

metro1

1:56 am on Mar 19, 2007 (gmt 0)

10+ Year Member



That was good for you but I cannot put an htacces file in the directory I want to exclude as it is locked by my ISP

I looked at the huge manual but found no simple way to just tell it to apply rules to everything except on directory - sounds really like a simple thing but no one seems to know the answer

jdMorgan

6:30 pm on Mar 19, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



See the mod_rewrite directive RewriteCond

Jim