MyBB Community Forums

Full Version: remove www from url name
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,

I am trying to remove the 'www' part from the url name, so make
http://www.example.com
into
http://example.com

I used this in my .htaccess file

Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_HOST}//s%{HTTPS} ^www.(.*)//((s)on|s.*)$ [NC]
RewriteRule ^ http%3://%1%{REQUEST_URI} [L,R=301]

But I get the logon screen and then it stays there after login data is entered...

What must I do?

Thanks!
Can you provide us with a link and a test account?
RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,QSA,R=301]
(2010-07-04, 10:11 AM)pyridine Wrote: [ -> ]Can you provide us with a link and a test account?

yes, can I give you that in PM?
First, try his code. If that doesn't work, go ahead.
Their wouldn't be much you could do with a test account anyway tbh. The only way to do this is a cPanel redirect (or equivalent) or using .htaccess.
(2010-07-04, 10:22 AM)Polarbear541 Wrote: [ -> ]Their wouldn't be much you could do with a test account anyway tbh. The only way to do this is a cPanel redirect (or equivalent) or using .htaccess.

I wanted to see the "error".
I think I know what's the problem. If I understand you, the person won't stay logged in. You need to change the cookie settings to the URL without "www."
ok, will try that.
and thanks!
Yes!
That was it Smile

So in inc/settings.php I changed the cookie url to lose the www

and in .htaccess I now have

Options +FollowSymlinks
RewriteEngine On

RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,QSA,R=301]

So far so good!

Thank you all again for your fast and expert help Smile
Change it in the ACPSmile
in configuration->general settings

Make sure the cookie domain has no www