Forum Moderators: phranque

Message Too Old, No Replies

rewrite urls except for .

         

jackvull

1:37 pm on May 8, 2011 (gmt 0)

10+ Year Member



I have the following code to rewrite all urls to www:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.mysite\.co\.uk)?$
RewriteCond $1 !^cart/updateorders\.php$
RewriteRule ^(.*)$ [mysitee.co.uk...] [R=302,L]

I have one script on my site that is run by a cronjob and I need to exclude that in the above code. How can I do that?
ie rewrite all pages except for [mysite...]
note the lack of www as this is how the hosting company calls cron scripts and the www rewrite is stopping the code form being run.

g1smd

4:48 pm on May 8, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The cron job should be running a local internal script filepath not calling a HTTP method.

Change 302 to 301 in the code. The code otherwise looks correct for a redirect excluding the script path.

jackvull

5:19 pm on May 8, 2011 (gmt 0)

10+ Year Member



Well, it's a hosting site so it runs URL scripts only.
How do I exclude 1 file, do I add another Rewrite Cond on a separate line?
The advice on the google forum was to use 302 as it was better for the bots.

g1smd

6:05 pm on May 8, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



The code above already excludes "cart/updateorders.php".

Duplicate that line, and change the path and file in order to add more exclusions.