Map Domain to WordPress Page - wordpress

Is there a way to map a domain name to a WordPress page?
For example, if I have mydomain.com/about/bio and mydomain.com/about/resume, could I map anotherdomain.com to the about page so I could use anotherdomain.com/bio and anotherdomain.com/resume?
Additionally, could I do it with a subdomain too?
Using the same example above, could I map about.anotherdomain.com to mydomain.com/about?
With WordPress, these aren't physical folders. They're pretty permalinks, so I'm having trouble figuring out how to make this work.
We have a Plesk control panel.
Thanks for any insight you can provide!
Edit:
The domains that I'd like to map to different parts of the URL may be registered from various providers.

You can achive this using the .htaccess file....
Just point the A record of your domain names to your domain. Now do the following...
RewriteCond %{HTTP_HOST} ^(www.)?mydomain.com
Rewriterule ^(.*)$ http://mydomain.com/about/bio [L]
RewriteCond %{HTTP_HOST} ^(www.)?myresumedomain.com
Rewriterule ^(.*)$ http://myresumedomain.com/about/resume [L]
RewriteCond %{HTTP_HOST} ^(www.)?anotherdomain.com
Rewriterule ^(.*)$ http://anotherdomain.com/bio [L]

Two possibilities you can explore:
A/ Using the plesk (or other registrar), you could try a wild-card redirect such as:
anotherdomain.com -> mydomain.com/about // with "wildcard" set to "yes".
B/ If that fails, you can create a simple redirect (anotherdomain.com -> mydomain.com) and then in WordPress (assuming it's living at mydomain.com), manually redirect individual URLs using the Redirection Plugin.
You would create individual rules like:
anotherdomain.com/bio -> mydomain.com/about/bio
C/ Finally, WordPress has become so good at redirecting broken links that you might be able to get away with simply redirecting the anotherdomain.com to mydomain.com and seeing if wordpress serves the correct page when an approximate URL is entered.
anotherdomain.com -> mydomain.com // this is the redirect you create
when people type anotherdomain.com/bio, WP might serve mydomain.com/about/bio auto-magically
Good luck!

if was me, I would do by 2 ways:
Domain forward domain1 -> domain2/about-page
Create a index.html and create a sub-folder on domain1 (ex: domain1.com/about) then linked to it. - Index.html will use iframe to call domain2/about.

Related

Editing htaccess file to redirect only content + Wordpress

I have created a subfolder in my webserver and installed wordpress there, it's working ok. And now i have created several subdomains. I need to show pages made in the wordpress installation in those subdomains but without changing the addess shown in the web browser address bar.
Options +FollowSymLinks
RewriteEngine on
RewriteOptions inherit
RewriteBase /
RewriteCond %{HTTP_HOST} ^sub.example.com$ [NC]
RewriteRule ^(.*)$ https://example.com/WPweb/index.php/pagetobeshown [R=301,NC,L,QSA]
with this i am being redirected and content is shown ok, but the address bar is changed.
is it possible to fix this so that address is not changed?
thanks in advance
To do this in .htaccess you would need to configure your server as a reverse proxy and proxy the request from the subdomain to the URL on the main domain. WordPress will then see this as a request for the main domain.
However, this does require some configuration in your server config to ensure the appropriate modules are loaded (mod_proxy, mod_proxy_http, etc.) and optionally to set ProxyPassReverse if WordPress should issue any redirects.
You can then use the P flag with mod_rewrite's RewriteRule to send the request through mod_proxy. For example:
RewriteCond %{HTTP_HOST} ^sub\.example\.com
RewriteRule ^$ https://example.com/WPweb/index.php/pagetobeshown [P]
This sends requests for https://sub.example.com/ only (ie. the document root of the subdomain) to the URL as stated. The NC, QSA and L flags are not required.
If you want to send any URL-path (as implied by your RewriteRule directive) to the URL on the target site then change the RewriteRule pattern from ^$ to ^ (simply remove the $). However, this many-to-one relationship is not necessarily good for SEO.
You will still need to modify the rel="canonical" link elements in the page to the appropriate URL in WordPress itself.
However, I'm sure there is a better, more WordPress-specific way to solve this. But WordPress would need to be configured to accept requests to the subdomain and the alternative URL-path.

Pointing a parked domain to a Wordpress Subsite without changing url

I have a client whose website develops & sells retirement villages in multiple locations, it's a Wordpress Multisite, with the main site being generic and the subsites are all the different locations. Basically we want to have an abbreviated domain for each location for advertising purposes that takes visitors to the correct location subsite, without changing the url, because we don't want to have to purchase SSL for every single domain/subsite.
so basically
locationA.com
when entered in the address bar goes to
https://mainsite.com/locationA
without changing the subsite url in the browser to LocationA.com - I know how to change the subsite domain via the wordpress admin settings but we don't want to change permalinks/urls unless there is absolutely no other way.
All the domains are parked at the mainsite's hosting,
I've tried redirecting via the cPanel Alias settings going to https://mainsite.com/locationA, but it always just takes us to https://mainsite.com/
RewriteCond %{HTTP_HOST} ^locationA\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.locationA\.com$
RewriteRule ^/?$ "https\:\/\/mainsite\.com\/locationA\/" [R=301,L]
I've tried other various .htaccess edits from other forums but they either break the site or just do the same thing as above and takes us to the generic mainsite.
e.g.
RewriteBase /
RewriteCond %{HTTP_HOST} ^locationA\.com$ [NC]
RewriteRule ^(.*)$ https://mainsite.com/locationA/ [L]
I don't really know what I'm doing with these, just trying things until something works.
Any help or insight would be greatly appreciated, thanks!
Nevermind, fixed it myself. The problem was that I added the domains as an 'Alias', redirection via CPanel worked when I added them as 'Addon Domains' instead.

Install Wordpress in subdomain on shared hosting

I'm trying to install Wordpress in a subdomain on a shared hosting.
Me and my father have a domain together - artazov.cz. I have my own subdomain michal.artazov.cz. I want to go one level deeper and make a blog in the subdomain of the subdomain - blog.michal.artazov.cz. Now, it shouldn't matter, how many levels deep I go if I match it directly with regular expression in .htaccess. So that's what I did:
RewriteEngine on
RewriteCond %{REQUEST_URI} !^/?subdom/michal/subdom/blog/
RewriteCond %{HTTP_HOST} ^(www.)?blog\.michal\.artazov\.cz [NC]
RewriteRule ^(.*)$ http://artazov.cz/subdom/michal/subdom/blog/$1 [L,P]
There are 2 problems with this.
Wordpress by default is set up in a way, that in General settings, "Site Address (URL)" is set to http://artazov/subdom/michal/subdom/blog. Therefore every link on the website, including permalinks to articles, have this signature, instead of http://blog.michal.artazov.cz.
When I change that setting to http://blog.michal.artazov.cz, the website returns 404 Not Found and I have to go to database and change it back.
Is there some way to set it up so it works and runs in the desired subdomain, including all the links, generated by Wordpress itself? Thanks
Perhaps you have attempted likely to: Configurations in Wordpress-Admin >> Media Configurations Then try altering both:
I think you may should try changing permalinks:
http://codex.wordpress.org/Using_Permalinks

redirect from one domain to another but keep requested page

I want to create a redirect for one of my domains to another.
I followed what reported in this question, and it works just fine.
The problem I'm having now is that I want to redirect www.example.com/some-page to
www.new-example.com/some-page.
Right now, www.example.com/some-page just redirects to www.new-example.com, this could be confusing for users who created bookmarks to some parts of the website.
Both URLs link to the same webhosting, and I'm running a litespeed server.
Add the following to your .htaccess file:
RewriteCond %{HTTP_HOST} !^yourdomain.com [NC]
RewriteRule ^ http://yourdomain.com%{REQUEST_URI} [L,R=301]
Edit: yourdomain.com should be the domain you wanna redirect to.

What is the canonical url of my website with www or without?

For my site: http://www.indiacustomercare.com which one is the canonical url with www or without www?
I've not changed any settings.
I remember that I changed this to www. in one for my previous drupal-6 website but I've forgotten it now(I did not change .htaccess).
So if I access my site as http://indiacustomercare.com then all pages seem to be without www ( except for those in the footer which are hardcoded with www...)
Similarly for when I access my site as http://www.indiacustomercare.com all web pages seem to have www prefix.
So what is my site's default www or without www?
Yes, in Drupal .htaccess there are pre-defined settings for this. Go to line 90-97, choose which domain you want to use (with or without www), uncomment the appropriate lines and add there your domain.
RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
RewriteRule ^(.*)$ http://www.example.com/$1 [L,R=301]
This one redirects from example.com to www.example.com.
There is also the opposite direction below.
You choose, but it's considered best practice to go with either one or the other, and not leave both available. If you set up a 301 Redirect, it is nicer for search engines.

Resources