How do I enable this:
If I type: maggew.com/abcxyz
you’ll get redirected to mr.maggew.com/abcxyz
If I type: maggew.com/privacy
you’ll get redirected to mr.maggew.com/privacy
if I type: maggew.com/refund
you’ll get redirected to mr.maggew.com/refund
If I type: maggew.com/contact
you’ll get redirected to mr.maggew.com/contact
etc..etc…etc….
I was using Shared Hosting on 1&1, and now I have a digital ocean droplet.
I tried to use HTACCESS REDIRECT GENERATOR but didn’t have much luck.
Here is my current .htaccess:
# REDIRECTS STORE
redirect 301 /shop http://mr.maggew.com/store
redirect 301 /market http://mr.maggew.com/store
redirect 301 /outlet http://mr.maggew.com/store
redirect 301 /bazaar http://mr.maggew.com/store
redirect 301 /boutique http://mr.maggew.com/store
# PROTECT WP-CONFIG.PHP
<files wp-config.php>
order allow,deny
deny from all
</files>
RewriteEngine On
RewriteBase /
RewriteRule ^index.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*.php)$ $2 [L]
RewriteRule . index.php [L]
#force subdomain of mr.maggew.com
RewriteCond %{HTTP_HOST} !^mr.
RewriteRule (.*) http://mr.maggew.com%{REQUEST_URI} [R,L,QSA]
Option 1
Option 2
if you have old url instances in your content you can use something like this to update to the new one. I’m not sure how effective this is.
http://www.wpbeginner.com/plugins/how-to-update-urls-when-moving-your-wordpress-site/
Option 3
or you can use http://wp-cli.org/ modify database instances or you can use mysql command line search and replace.
all of your urls from content and page referencing urls are stored in the database. you can do a mass search and replace if you know what you’re doing.
Assuming you are on the same host and directory structure, you can add a condition checking for the subdomain in the HTTP_HOST, if the subdomain is missing you can redirect to it.
Alternative
The following instructions not working in 2023, so I do research on it.
In my case, you can use…
Read full details at https://www.arnlweb.com/forums/web-development/what-is-htaccess-redirection-how-to-use-it