If you’re getting 404’s, then there MUST be something wrong with your mod_rewrite code.
RewriteEngine on
[COLOR="Gray"]# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName site.com
AuthUserFile /home/sitecom/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/sitecom/public_html/_vti_pvt/service.grp[/COLOR]
RewriteCond %{HTTP_REFERER} !^http://www.site.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.site.com$ [NC]
[COLOR="Red"]RewriteEngine on
# Again? Remove this line[/COLOR]
RewriteRule ^/?([a-zA-Z_]+)(/([a-zA-Z1-9_]+)(/([0-9]+))?)?$ index.php?var1=$1&var2=$3&var5=$5 [L]
# capture one or more letters and _'s in first atom,
# one or more letters, digits (except 0) and _'s in the third atom
# and one or more digits in the fifth atom
# with only the first atom required
# and the third atom required for the fifth
# with no trailing /
[COLOR="Blue"]# ANDed with the {HTTP_REFERER} RewriteCond statements[/COLOR]
RewriteRule ^/?([a-zA-Z_]+)(/([a-zA-Z1-9_]+)(/([0-9]+))?)?/$ index.php?var1=$1&vae2=$3&var5=$5 [L]
# Ditto the above EXCEPT requiring a trailing /
# (BAD IDEA as it requires absolute links in the
# index.php script or HTML's <base> directive)
# AND is NOT subject to the
# RewriteCond {HTTP_REFERER} statements
The 301 would have told you what the redirection was TO and that should have given you an indication of the problem.
WHY do you think the No Case flag is useful in a RewriteRule?
Try:
RewriteEngine on
# RewriteRule ^/?([a-zA-Z_]+)/([a-zA-Z1-9_]+)$ index.php?var1=$1&var2=$2 [L]
# That's duplicated by the optional atom in the following RewriteRule
RewriteRule ^/?([a-zA-Z_]+)(/([a-zA-Z1-9_]+)(/([0-9]+))?)?/$ index.php?var1=$1&var2=$3&var5=$5 [L]
RewriteEngine on
# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName site.com
AuthUserFile /home/sitecom/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/sitecom/public_html/_vti_pvt/service.grp
RewriteCond %{HTTP_REFERER} !^http://www.site.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.site.com$ [NC]
RewriteEngine on
RewriteRule ^/?([a-zA-Z_]+)(/([a-zA-Z1-9_]+)(/([0-9]+))?)?$ index.php?var1=$1&var2=$3&var5=$5 [L]
RewriteRule ^/?([a-zA-Z_]+)(/([a-zA-Z1-9_]+)(/([0-9]+))?)?/$ index.php?var1=$1&vae2=$3&var5=$5 [L]
Will this now stop it being a temporary redirect and make it a permanent?
And is there any way of losing the 2nd line to allow for ‘/’ or the lack of in just 1 ??
I was more worried all my search engine efforts will be thwarted by every page on the site now being 301 (as AWstats seems to keep telling me).
Ehm… 301 is a permanent redirect. It’s also the redirect you want to give your PR from the previous location to the new location.
That being said, your script currently doesn’t externally redirect at all. You should change [L,NC] to [L,NC,R=301] and then remove the NC because you really don’t need in the rules – you already have a-zA-Z in the regex so it’s already case insensitive. So, change [L,NC] to [L,R=301]
Simple: Unless otherwise directed, mod_rewrite makes TEMPORARY redirections (302) rather than PERMANENT redirections (301). Since I don’t see a 301 anywhere above, they’re all temporary.