Redirect from different port to subdomain - htaccess

by George Alvis   Last Updated July 11, 2019 19:08 PM

I created a Digital Ocean instance to install wordpress website 5 days ago. I already have my own domain, and created DNS Subdomain blog.mydomain.com. the server runs both nginx and apache so my apache port is 8082. Below is my actual wordpress URL looks like.

www.example.com:8082/wordpress/

Something which i have tried is below.

<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?example\.com:8082/wordpress\
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ([a-z0-9-]+)/? http://$1.example.com [R=301,NC,L]

</IfModule>

Now my expected result is from

www.example.com:8082/wordpress\ 

to

blog.mydomain.com
Tags : htaccess apache


Related Questions


Updated July 14, 2017 13:08 PM

Updated September 02, 2017 22:08 PM

Updated November 13, 2017 20:08 PM

Updated July 15, 2019 03:08 AM

Updated March 26, 2015 09:02 AM