Jump to content

Redirect from the non WWW domain to the WWW domain in the Azure WordPress Market Place offering-


Recommended Posts

Guest Arjun_Baliga
Posted

1. Navigate to your App Service via the Azure Portal. Under the Development Tools section, select SSH then Go -->.

 

mediumvv2px400.png.b3f38d442184416e5dc3cc455f7c00b9.png

 

 

 

2. Modify the default site config - You would need to make a copy of the existing configuration and place the file inside the /home/site directory by running the below command.

 

 

 

 

 

cp /etc/nginx/conf.d/default.conf /home/site/default

 

 

 

 

 

 

 

mediumvv2px400.png.eddb00c6b5535974a70c538b672cb877.png

 

 

 

  1. Go to https://<app name>.scm.azurewebsites.net/newui/fileManager click on Modify site/default file.

 

mediumvv2px400.png.7e97730f401f5359bde5993e38cf0cc6.png

 

 

 

  1. in the existing server block update the server name to www domain

 

 

 

 

 

server {

 

listen 80;

 

## Your website name goes here.

 

server_name www.example.com

 

 

 

 

 

 

 

  1. In the same default.conf file, you can create a new server block and add the below configurations for non-www to www redirection -

 

 

 

 

 

server {

 

listen 80;

 

server_name example.com;

 

return 301 $scheme://www.example.com$request_uri;

 

}

 

 

 

 

 

 

 

// This directive tells Nginx to send any request //for http://example.com to http://www.example.com with HTTP redirect code 301.

 

  1. Copy the following code snippet to /home/dev/startup.sh.

 

 

 

 

 

cp /home/site/default /etc/nginx/conf.d/default.conf

 

/usr/sbin/nginx -s reload

 

 

 

 

 

 

 

  1. Please restart App Service and verify that the redirect from non www domain to www domain works fine.

 

Continue reading...

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...