I am using wordpress, I have installed LAMP, created virtual host and migraated a website from other host consists www, but here in Digital Ocean I have failed to bring the www by all means. May be something I am missing. Please someone please guide me step by step.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Hello @mushfiq
The DNS seems sorted, so the only thing left to do is to handle the redirect itself. In Apache, this mostly happens in the .htaccess file, but you also need to ensure that
Mod Rewrite
is enabled.First, to enable the
mod_rewrite
module you need this command:With the Rewrite module enabled, we can configure Apache with redirect rules using
.htaccess
files.You can use the .htaccess file rule provided by KFSys.
Hope that this helps
Heya,
To redirect a non-www domain name to a www domain in a WordPress setup on a LAMP stack, you’d typically make modifications to the Apache configuration or to the
.htaccess
file within your WordPress directory.I’ll recommend adding the 301 Redirect in your .htaccess file rather than in the Apache configuration.
Backup: Before making any changes, it’s always a good practice to backup your current
.htaccess
file.Access
.htaccess
File: Navigate to the root directory of your WordPress installation, where you should find the.htaccess
file.Open the
.htaccess
file.htaccess
file, add the following lines:Replace
example.com
with your domain name.Settings
>General
.www
.