-
.htaccess help
Hi,
I am wondering what I might be doing wrong. Do I have a wrong code in here or a space in the wrong place :confused:
Question 1 Try going to my site with the www. works OK without but not with.
Question 2 I want the .gif to hotlink for my banner exchange but it does not show up.
Question 3 Anything that you would add or change? And Why?
Here is what I am using.
Code:
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST} !^britneyspearsfans\.info
RewriteRule (.*) http://www.britneyspearsfans.info/$1 [R=301,L]
# disable directory browsing
Options All -Indexes
# protect the htaccess file
<files .htaccess>
order allow,deny
deny from all
</files>
# disable the server signature
ServerSignature Off
# protect php.ini
<files *.ini>
order allow,deny
deny from all
</files>
RewriteEngine on
RewriteRule ^MSOffice/(.*)$ / [R=301]
RewriteRule ^_vti_(.*)$ / [R=301]
RewriteRule ^(.*)index.rdf$ /rss.php [R=301]
### no hotlinking
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^http://(.+\.)?britneyspearsfans\.info/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpe?g|JPG|bmp|png|tiff)$ - [F,NC]
Redirect permanent /robot.txt http://britneyspearsfans.info/robots.txt
Redirect permanent /robotsxx.txt http://britneyspearsfans.info/robots.txt
Redirect permanent /xxx_robots.txt http://britneyspearsfans.info/robots.txt
Thanks in Advance
Buttterflies Forever
Sami
-
Hey,
You've got a small error here in your httaccess :
Code:
RewriteCond %{HTTP_HOST} !^britneyspearsfans\.info
RewriteRule (.*) http://www.britneyspearsfans.info/$1 [R=301,L]
What that is doing is if the host is not exactly 'britneyspearsfans.info' it'll redirect to the www, however, when trying to visit the www version of your site, you see that it doesn't work because your condition is like "hey this doesn't match the htaccess ReWriteCond, I'll redirect it" and then it gets stuck in a loop doing that over and over again.
If you only want it available on the www you'll need to change that condition to look like so :
Code:
RewriteCond %{HTTP_HOST} !^www\.britneyspearsfans\.info
RewriteRule (.*) http://www.britneyspearsfans.info/$1 [R=301,L]
For your other question, I'm not sure what you're asking about what gif?
-
Hi,
What I would like it to do is go to the site :) if they type www. or not. Also want the link juice to be combined. Some links I placed with the www and some I placed without.
My other site has this code on it. Is this what I need?
I know change the url name.
Code:
RewriteCond %{HTTP_HOST} ^freewomensblogs.info$ [OR]
RewriteCond %{HTTP_HOST} ^www.freewomensblogs.info$
RewriteRule ^(.*)$ "http\:\/\/freewomensblogs\.com\/" [R=301,L]
As for the the .gif question do I have the hotlink code right?
What I want it to say is The only thing that anyone could hotlink off the site is .gif files
All the rest would be shut off.
Also what do thes codes do?
Code:
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-.*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
<IfModule mod_security.c>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>
Just want to cover all my bases.
Thanks
Sami
-
Hey,
You can use either this :
Code:
RewriteCond %{HTTP_HOST} !^www\.britneyspearsfans\.info
RewriteRule (.*) http://www.britneyspearsfans.info/$1 [R=301,L]
or this :
Code:
RewriteCond %{HTTP_HOST} !^britneyspearsfans\.info
RewriteRule (.*) http://britneyspearsfans.info/$1 [R=301,L]
Either one will work. Both will accept connections from www and nonwww. The only differences being that the link juice will be combined to go to the format you choose.
Ah okay I get what you were asking, your "no hotlinking" code in the first post appears to be okay except for the last line should be [NC,F] instead of the opposite. Though you could take out the 'JPG' entry since the 'jpe?g' will cover that.
As for those other things, sorry I'm not sure what they are, though some look like they might belong to wordpress? I dunno.