Any recommendations or best practices for mapping a subdomain to a Wordpress page:
http://my-page.mydomain.com -> http://mydomain.com/my-page
I don't want to do a redirect either, just keep the original subdomain URL until a different link is click, and then the subdomain is removed.
I'm using Apache 2 with mod_rewrite, wordpress 2.7 with pretty-urls, and php 5.
As already mentioned I would use mod_rewrite to get this done. Something like the following should work in the my-page.mydomain.com virtual host
RewriteEngine on
RewriteRule (.*) http://mydomain.com/my-page$1 [P,L]
This will require you to enable mod_proxy. Please read the security implications of doing this on the Apache website http://httpd.apache.org/docs/2.2/mod/mod_proxy.html
URL Rewriting. I would start here
What you want can be achieved with mod_rewrite.
Keep in mind that google will detect the two pages as duplicates, which may hurt your pagerank.
Related
I have an hosting with ipage and I have 5 domains on this hosting. My master domain is called eroups.com, and I already bought ssl for it but when I ask my hosting support to redirect it from http to https all my domains are redirecting to https and I don't have ssl for them yet.
And I make for this other each domain folder as redirect into this folder please if some one know how to fix that I just need to redirect eroups.com to https only and other same like http.
My domains are:
eroups.com (this is the master and have ssl)
imolawigs.com
imolagallery.com
kittyshoping.com
kittywedding.com
Please someone write the code for me I can't understand how to make that by myself and support didn't understand anything also.
so basically there are 4 main steps:
update the url in your database http://yourdomain.net -> https://yourdomain.net
set a http to https redirect in your .htaccess file
check for any hardcoded http://yourdomain.net occurrences in the source files of your theme
check for external resources which are loaded via http://.... (fonts, images, ...) and correct them to https://
Do you have some programming skills? Then I could sent you the tools and code snippets which you can use to accomplish the transition from http to https.
Unfortunately this process can not be automated by a plugin.
Cheers, Dominik
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
If you don't want to code/touch your servers, you can achieve this without writing any code only by using a CDN for example if using Cloudflare: How do I redirect all visitors to HTTPS/SSL?.
The domain names used are only examples, so if you could use those example names in your answer that would be great. I'm having a very hard time wording exactly what I'm trying to do and because of that can't find the answer via searching, so I'm posting it as this analogy:
I work for a company that makes WordPress sites. We'll call that company SuperMedia, and their main website is supermedia.com. SuperMedia wants to host their clients' sites on their own server via subfolders. So in this case, we've created a client's WordPress site in the directory http://supermedia.com/greatclient/
The issue is that our client has a domain name, friendlyclient.com, and we need to link this domain name to their site which we are hosting on our server, but we don't want the urls to show "supermedia" at all.
So in simplest terms, right now all of our page urls look like this:
http://supermedia.com/greatclient/about
http://supermedia.com/greatclient/our-services
http://supermedia.com/greatclient/gallery
(etc...)
But we want them all to say:
http://friendlyclient.com/about
http://friendlyclient.com/our-services
http://friendlyclient.com/gallery
(etc...)
but still display the information on http://supermedia.com/greatclient/about, http://supermedia.com/greatclient/our-services, http://supermedia.com/greatclient/gallery, etc. respectively.
Is there a simple, fairly fast way to do this for all the pages we've created, either using .htaccess or some kind of plugin? I don't have a lot of back-end programming/database knowledge, so if it involves advanced programming, could you lay-out some steps on how I can achieve this?
If you are using apache, you can use mod_rewrite to do the rewriting. Try adding this to your .htaccess file(In the friendlyclient.com root folder)
# Match the host
RewriteCond %{HTTP_HOST} ^([^\.]+)\.com$ [NC]
# proxy the entire request to the /host/ and path
RewriteRule ^(.*)$ http://www.supermedia.com/%1/$1 [L,P]
This will make it so requesting http://friendly.com/about will serve http://www.supermedia.com/friendlyclient/about and dont forget to rename ur folder, from greatclient to friedlyclient
Hi I have wordpress installation in subfolder /blog/, as it has to co-exist with other legacy cms, so now if i wish to access some page of wordpress i need to use links as
www.domain.com/blog/news/ and would like to rather use www.domain.com/news/.
So basically for certain links i need to add this /blog/ somehow internally so wordpress
would handle it normally.
Please note it will be few links so rewrite rules can be literal.
Rewriting URI's for wordpress can always be kind of sketchy because wordpress has its own way to do routing and may not play nicely with other rewriting sometimes, but you can try:
RewriteRule ^/?news/some-page$ /blog/news/some-page [L]
As long as they're before any other wordpress related rules.
I have a Python web app hosted with Google App Engine with a .com pointed towards the App Engine app. I would like to start a Wordpress blog at mydomain.com/blog.
Since Wordpress runs on PHP, I reckon it would be easier to host the Wordpress blog on my other web host account with cpanel and change some domain pointer. What is the best way to achieve this?
I suppose setting a DNS A Name record for 'blog' to point to my other web host account will create blog.mydomain.com and solve this. But is there a way to have mydomain.com/blog pointed to the other web hosting account with the Wordpress blog? Thank you.
Another approach similar to renab's: on your Wordpress box you can configure the Apache (or any other sensible http server) to work as a proxy in front of your App Engine application for every URL but the /blog one (which would be served directly).
You could also enable some level of caching on the Apache server and save a little on processing costs.
A simple solution may be to create the A record you mentioned in your question then put an index.html in the blog/ directory on app engine that contains
window.location = "http://blog.mydomain.com"
as the onload function of the body tag.
Another solution is adding a .htaccess file which redirects http://www.mydomain.com/blog to http://blog.mydomain.com.
Edit: As mentioned in the comment below, appengine does not support this method. I am leaving it in for the off chance that it will help someone who has a similar question not related to app engine.
A similar redirect would be needed for the domain without www in front of it.
Edit for better htaccess example:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain\.com$
RewriteRule ^blog/(.*) http://blog.mydomain.com/$1 [R=301,L]
You will have to check my htaccess syntax, its been a while since I had to write rewrite rules, and I don't have a webserver handy to test it
I have a website and want to redirect all its pages to posts on my blog. I browsed through my website folder but could not find the '.htaccess' file. Is it provided by the web hosting or can I create my own and use it? Can it be only used with Apache server.
If that's not possible what other option do I have for redirection.
Janice
You create your own .htaccess, by simply opening a document and saving it as .htaccess.
You'll want something like this in it:
RewriteEngine on
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
Perhaps you just don't see the .htacces file. The dot at the beginning of the file name indicates that this is a hidden file and will not be displayed normally.
If you don't want to mess around with editing your .htaccess file, Redirection is a good Wordpress plugin that handles 301 redirects, logs, etc. and is easy to use.
.htaccess is for Apache only, other web servers have their own methods of configuration and do not use .htaccess files.
Since this is tagged "Wordpress" maybe you are using that? Wordpress will create one after you've turn on pretty permalinks.