Make www Redirect

@halilesen · 22 Apr 2024 · 300 views
Post Reply
User avatar
halilesen
#1 ·
Posts: 55
Joined: 24 Mar 2024, 18:09
Full Name: Halil ESEN
Has liked: 11
Been liked: 9
Do you use your domain name with or without www? No problem for you? I can tell you from experience that you have to choose one. Personally I like to use it without www. I think www is outdated :) Joking aside, I have seen some problems with using both at the same time for cookies. On the other hand, you need to make sure that search engines only index one of them.

Ok, if you have decided which one to use, let's do www redirect. If you are using www, when users enter your phpBB board without www they will be redirected to the URL with www, if you are using without www, when users enter your phpBB forum with www they will be redirected to the one without www.

Open the .htaccess file in the root where your phpBB is installed.

Code: Select all

<IfModule mod_rewrite.c>
RewriteEngine on

First, you will see a code like the one above. Choose one of the following codes according to your preference and add it to the next lines.

If Your Website Does Not Start With WWW

Code: Select all

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
If Your Website Starts With WWW

Code: Select all

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
Save it. Thus, we have made www redirection in phpBB.
Post Reply
  • Similar Topics