Wedge
Public area => The Pub => Off-topic => Topic started by: MultiformeIngegno on January 8th, 2012, 12:50 AM
-
I'm using this cond to redirect my forum.domain.com subdomain to domain.com/forum folder:
RewriteCond %{HTTP_HOST} ^[www\.]*forum.domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
Everything works fine, except for Aeva links.. for example I have this image:
http://forum.domain.com/index.php?action=media;sa=media;in=252;thumb
Instead of:
http://domain.com/forum/index.php?action=media;sa=media;in=252;thumb
it gets redirected to:
http://domain.com/forum/index.php?action=media%3bsa=media%3bin=252%3bthumb
So I get a 404 error.. seems like a char-set problem!
-
No, not a charset problem. Apache is doing what it's supposed to be doing, rewriting %3b characters as per the HTTP specification.
Try:
RewriteRule ^(.*)$ http://domain.com/$1 [NE,R=301,L]
-
You clearly deserve a statue....
-
I've done my fair share of fighting with RewriteRules in the past, I'm trying to give it up, it's like smoking: you kind of enjoy it even though you know it's bad for you.
-
Ahaha!
Anyway I'm ditching many rewritcond I had because there are other ways to achive some things. For example I had a rewrite rule that redirected all www hits to the non-www url. I just left the domain.com A record, removed the www one and replaced it with a CNAME (from www to the "pure" @ domain). I think it's more clean.
-
Are you a smoker, Pete?
-
Ahaha!
Anyway I'm ditching many rewritcond I had because there are other ways to achive some things. For example I had a rewrite rule that redirected all www hits to the non-www url. I just left the domain.com A record, removed the www one and replaced it with a CNAME (from www to the "pure" @ domain). I think it's more clean.
That can work but it has other consequences, most notably that you will have 'duplicate' content because both www. and non www. links will point to the same content. Having a forced redirect solves that.Nope, but both my parents, both step parents, all my aunts/uncles on mother's side, plus my maternal grandparents, plus half my dad's family (including maternal grandmother) all smoke(d)
It's more the fact that I understand the psychology, it's pretty similar to when I gave up alcohol for the most part some years ago (I still have the odd drink, but it's once every few months, and even then, it's invariably just the one, two for really special occasions)
-
D'oh.. I thought that CNAME "redirection" solved the problem of duplicate content... because when you visit www.domain.com(http://www.domain.com) you are physically redirected to domain.com. Don't search engines follow this behavior and consider only non www content? Also because the www subdomain doesn't exist in reality (if you search for A records you get none)..
-
Anyway if I add a 301 redirect from www to non-www I should "restore" the A record for the www entry, right? It wouldn't work if I had a CNAME record for www (because hits get redirected before "reading" the .htacces)? :)
-
No, CNAME means canonical name, it doesn't perform redirection. The whole point of CNAMEs is to provide multiple pathways to the same destination.
The rest of the code on your site might be doing that redirection, however, and I know SMF has internal handling to shunt users to the proper domain.
If you add a 301, you should indeed restore the A record and deal with the redirection on the server yourself, it's the only way to be sure.
-
'kay! Restored A entry. :whistle:
Now, because you are a genius.. you can explain me WTF does this code do (in .htaccess).. :hmm:
<Files ~ "^.*\.([Hh][Tt][Aa])">
order allow,deny
deny from all
satisfy all
</Files>
-
That code checks for anyone requesting files that begin with .hta (like .htaccess) and blocks the request entirely. Though that shouldn't be necessary in an .htaccess file because the stock Apache configuration expressly denies that at the highest level.
-
Absolute GENIUS! :cool: