IWETHEY v. 0.3.0 | TODO
1,095 registered users | 1 active user | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Re: Can someone check my mod_rewrite rule?
One declaration per vhost for "RewriteEngine On"


RewriteCond %{HTTP_HOST} ^blog\.cooklikeyourgrandmother\.com

RewriteRule ^http://blog\.(.*)\.html$ http://cooklikeyourgrandmother\.com/blog/$1/ [R=301,L]


That to me looks like you are not understanding it properly (or typo'd).

That particular rewrite rule expands to this:

http://cooklikeyourgrandmother.com/blog/cooklikeyourgrandmother.com/year/month/title/

Unless less you meant:
RewriteRule ^http://blog\.cooklikeyourgrandmother\.com/(.*)\.html$ http://cooklikeyourgrandmother\.com/blog/$1/ [R=301,L]



You might also want to take the time to prevent image theft. Using something similar to:

SetEnvIfNoCase Referer !\.cooklikeyourgrandmother\.com no-external-linking=1

ReWriteCond %{ENV:no-external-linking} 1
RwriteRule \.(gif|GIF|jpg|JPG|png|PNG)$ /bollocks/no-external-linking.png [PT,MC]


New Yeah, was a typo -- solved
But this:
RewriteRule ^http://blog\.cooklikeyourgrandmother\.com/$ http://cooklikeyourgrandmother\.com/blog/ [R=301,L]

keeps giving me
Forbidden

You don't have permission to access / on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


If I redirect everything:
RewriteRule .* http://cooklikeyourgrandmother\.com/blog/ [R=301,L]

it works, so something in the match pattern isn't matching.


[edit]

In an .htaccess file, RewriteRule starts looking after the domain. The rule I wrote would have worked in an httpd.conf file.
--

Drew
Expand Edited by drook Nov. 25, 2009, 12:50:26 PM EST
     Can someone check my mod_rewrite rule? - (drook) - (2)
         Re: Can someone check my mod_rewrite rule? - (folkert) - (1)
             Yeah, was a typo -- solved - (drook)

Given enough shellac, even turds can be polished.
42 ms