Log in

View Full Version : .htaccess problem


Dr Bizzaro
2010-02-23, 10:37 AM
I just bought a site and I was looking through the stats and see that a lot of traffic is being sent to:

http://www.domain.com/index.php/feed/

My normal htaccess file does not work because it's going to index.php/feed/ and not just /feed/

Not sure what I can add to my htaccess to get that to redirect back to the main page.


Here is what I currently have:

AddHandler server-parsed .html
AddType text/html html


RewriteEngine on
RewriteOptions inherit
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://www.domainname.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://domainname.com*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://domainname.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domainname.com*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://domainname.com:80/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domainname.com:80/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://domainname.com:80.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.domainname.com:80.*$ [NC]

RewriteRule (gif|jpg|png|swf|mpg|avi|GIF|JPG|PNG|SWF|MPG|AVI)$ http://www.domainname.com [R,L]

ErrorDocument 400 http://www.domainname.com
ErrorDocument 403 http://www.domainname.com
ErrorDocument 404 http://www.domainname.com
ErrorDocument 501 http://www.domainname.com
ErrorDocument 502 http://www.domainname.com
ErrorDocument 503 http://www.domainname.com

Dr Bizzaro
2010-02-23, 11:30 AM
Keeping in mind that I used "domain.com" in place of the actual domain.
I don't actually own domain.com

|thumb

cd34
2010-02-23, 01:25 PM
RewriteEngine on
Rewriterule index.php/feed/ http://www.domain.com/ [R=301,L]


not sure exactly where you want it to head, but, http://www.domain.com/ will redirect it to the root of the domain with the www. preceding.

you might consider replacing:


RewriteRule (gif|jpg|png|swf|mpg|avi|GIF|JPG|PNG|SWF|MPG|AVI)$ http://www.domainname.com [R,L]


with


RewriteRule (gif|jpg|png|swf|mpg|avi|GIF|JPG|PNG|SWF|MPG|AVI)$ http://www.domainname.com/ [R=301,L]


Since your other rewrite will do a 302 and you might be unintentionally scraping your results. Without the trailing / on the url, you would also force the surfer (or spider) to have to do a 301 redirect to properly grab the file at the root.

Dr Bizzaro
2010-02-23, 01:46 PM
Awesome. Works perfect.
Thanks!