Greenguy's Board

Greenguy's Board (http://www.greenguysboard.com/board/index.php)
-   General Business Knowledge (http://www.greenguysboard.com/board/forumdisplay.php?f=10)
-   -   .htaccess problem (http://www.greenguysboard.com/board/showthread.php?t=56508)

Dr Bizzaro 2010-02-23 10:37 AM

.htaccess problem
 
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:

Quote:

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

Code:

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:

Code:

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

Code:

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!


All times are GMT -4. The time now is 10:56 PM.

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© Greenguy Marketing Inc