![]() |
Force WWW with htaccess
hello
i want to force www on my forums so that if its typed without the "www" it automatically adds it my forum not on the main domain, it is a subdomain so the code needs to be made to work within the directory where my forum is on my forum is in a directory called "forums" so basically: http://mysite.com/forums i want everything within the that directory to automatically get the "www" Can someone please help me Thank You :) |
google is your friend (as is search since this has been covered many times before)
http://davidwalsh.name/no-www-using-htaccess-file (examples for with or without www included in above link.) |
ive tried those before but it would redirect:
http://mysite.com/forums/forum.php to http://www.mysite.com/forum.php (leaving out my directory) |
If you are having problems, please post *exactly* what you used and then tell us the *exact* problem you are having with that code.
|
This is what i used and it just gave me the page not found error
Code:
RewriteEngine On |
foruns? That isn't going to work. mydomain.com won't work either. That also doesn't look like the link I posted. I use something that looks very much like the stuff in the link I posted and it works fine.
|
This works for me:
Code:
Options +FollowSymLinks |
Quote:
my forum is in a directory within my domain this is similar to my issue: http://www.vbseo.com/f4/add-www-via-...-folder-42567/ |
My forum is not installed in the root and that htaccess works fine for me. If you are using vbseo, then you will need to ask them for help with the issue.
|
Can you post your exact code so i can just replace it with my domain
Thank you |
Mine is almost the same as Valter's.
Code:
RewriteEngine on |
Quote:
where do you include the "/forum" directory there so it doesnt redirect to the root domain where my forums isnt at... |
That works for my site even though I have my site in /forums
Have you tried these? It just takes seconds to see if it works or not. |
got it working!
had to make a minor change to that code though Thank You |
Quote:
|
Here is what I use to redirect to my forums dir:
Code:
Options +FollowSymlinks Lynne, what is the $1 for at the end of your site url? |
Quote:
Quote:
|
You lost me. How does it know what page to show?
|
Think of $1 as like a variable. You passed it a url mydomain.com/somelinkhere.php and the somelinkhere.php is the $1.
At least, that is how I think of it. |
That is what I thought. But I don't see you setting it anywhere in the htaccess. Where does it get set?
|
It just... is.
I honestly can't speak too much about htaccess and that variable. Some things I haven't totally wrapped my head around. .htaccess and preg_replace are two things I need to just force my way through. |
Ok, but in your case, what is it passing? Do you know? And wouldn't it work the same without it?
Like you, pre-replace and regex are areas which I'm not sure I will ever understand fully. htaccess gets a little less confusng the more I work with it. |
You are 'passing' the stuff after the url. It may work perfectly fine without it - I've never tried it. I just found something that worked for me and I've kept it.
|
All times are GMT. The time now is 07:03 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|