Jump to content

[Solved] www URL redirection


Recommended Posts

Hello!
Excuse me. Could you help me?
For my hosted domain: Maracaibo.info, I need that any URL begining with www, to be redirected to the URL version without www. Is that possible?
The reason is that I've a small problem with some links opening in a new tab of the web browser.
Thank you for any help.

Link to comment
Share on other sites

3 hours ago, juanvp said:

Hello!
Excuse me. Could you help me?
For my hosted domain: Maracaibo.info, I need that any URL begining with www, to be redirected to the URL version without www. Is that possible?
The reason is that I've a small problem with some links opening in a new tab of the web browser.
Thank you for any help.

Yes, create a .htaccess file inside your httpdocs folder and put this as it's contents:

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

Let me know how it goes.

  • Like 1
Link to comment
Share on other sites

Thank you very much.

I put that code inside .htaccess, saved it and then the links we're not working, After that, I put the former code of .htaccess, saved it again and something happenned. It's just working now as it was desired, all links opening in the same Tab. That's all fine!!

Thank You again.

Link to comment
Share on other sites

The complete solution was to add only these lines inside the <ifModule mod_rewrite.c> Tag:

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]

RewriteRule ^(.*)$ https://%1/$1 [R=301,L]

To an existing .htaccess file. Without deleting the former content.

For it could be useful for other people. Thank You.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...