Move wordpress installation from subdomain to root and keep links - wordpress

ok this is bit weird question:
here is my domain: hfarazm.com
and wordpress installation at: blog.hfarazm.com
I have lots of visitors and they have shared my blog and article links all over.
I want to organize my site for separate section for tutorials, for blog, for portfolio and for other things.
Right now everything is going to blog.hfarazm.com i want to move blog to root but want to keep links so that users dont see 404 page and i get a chance to manage my site from the root.
I know: changing url in settings of wordpress will do the job but is redirecting is good practice? what is the better solution to achieve this confusing state.

You can create an .htaccess rules so your visitors will be redirected to new location, even if they type the URL blog.hfarazm.com.
See detailed information here.
Note that many of these examples won't work unchanged in your particular server configuration, so it's important that you understand them, rather than merely cutting and pasting the examples into your configuration.

Related

Install wordpress on subdomains

I need some help with wordpress. I have got a wordpress on my main domain and I would like to use another wordpress on my subdomains with the same theme, plugins, blog pages and posts but different links in my blog posts. I want to know how I can change the links in my blog posts for the main domain and the subdomains?
Do I need to create a subdirectory folder and a different database name for each subdomain and do I also need to copy the wordpress files from the main domain to the subddirectories folder so I could be able to create the username and password for the subdomains and then login in the wordpress for each subdomain to change the links in the blog posts?
I want you to understand that I want to use the main domain and subdomains to use the same theme, same plugins, same blog posts and same pages but the links in the blog posts have to be different, because I am going to use different traffic sources on each subdomain to track for clicks and sales, example: my main domain will be use for google traffic, the blog subdomain is for facebook and the other subdomain is for easyhits4u. I can track the clicks and sales for google and other traffic sources because the links in the blog posts for the main domain and subdomains would not be the same.
If I use the same links in the blog posts for the main domain and the subdomains, I would not know how many clicks and sales I would get from each traffic source I use and I would not know where the clicks and sales are coming from. That is why I want to use it seperate so I can track it easy.
To go a little further about the comment of #Sysix :
As far as I know, Wordpress Multisite allow you to have one folder that hold all of your websites. Your websites url can be subdomains or subfolders based (but this one not need to have a real subfolder, it's only about the url)
subdomain.example.com
example.com/subdomain
At my last work, the php developper made a plugin or something that allow you to have different urls for each site of the network.
example.com
example2.com
etc.
(I'm gonna search some informations about it, if you are interested in)
Websites are handled with the database only, and if you take a look at the wordpress database after you have create a new site in the network, you will get new tables wp_posts, wp_meta etc. with a number after them that is related to the site id.
So i think that the best way for you is to make one website, create all the post, the pages, and when it's done, duplicate it in a new site in the network.
You can use the plugin in the link below to duplicate a site of your network.
https://fr.wordpress.org/plugins/multisite-clone-duplicator/
Just a warning : I know that this way it could works, but I also know there some conditions to make it works great. I can't remember exactly why but I seem to recall that you can't easily duplicate the main website of the Network. There was a workaround to do it but I don't remember exactly what was the issue, and how to resolved it.
I'm gonna search and test some stuff right now, so this answer is not definitive but it could get you on the way. I will edit it if i find or remember some important thing.
Sorry for this answer that is not really an answer, but in comment it was not possible to write all this ... Also if I said nonsense, please correct me, and I will edit the post as well.

Automated 301 redirect for any missing pages within specific directory

I am trying to help a friend move a Wordpress site to a new server. However, it has many old blog pages that he'd like to have deleted.
Instead of doing a 301 redirect for each and every blog that is about to be deleted back to the blog main page, is there a way to automatically create a 301 redirect for any of the missing pages of that directory only?
For example, any page that does not exist at www.website.com/blog/... would be automatically redirected to www.website.com/blog/ (not homepage)
However, for any other page such as www.website.com/otherdirectory/... would be treated as a regular 404 page.
Hope this makes sense.
We have Urban Giraffe's Redirection plugin installed for one off redirects already. Would be super if the other blogs to be deleted could be fully automated.
Thanks in advance.
Found my own answer (sort of) - hope this can help others:
Auto Redirect 404 in 301 for Trashed Posts
http://wordpress.org/plugins/auto-redirect-404/
There are a few caveats though. This plugin monitors what you are about to delete and then automatically creates a 301 redirect. Note that this does not help with already deleted posts.
Note that I have installed this, but I have now removed it after doing all of the deletions. Once I deleted all the unnecessary posts, it created a list of the 301's. I have copied this list then imported them into the Plugin below so that it can be managed by 1 plugin. Also, the issue I have with this plugin is that it also monitors media and pages. This means that if you delete a page (ie ...com/test/) it will make a redirect - however, if you create a page again later with the same URL (ie ...com/test/) that page will no longer be visible as the redirect has been created in a table of your database. This plugin does NOT let you undo a redirect. If you deactivate the plugin, the 301's will stop working so that is the only way to stop the redirects. All or nothing.
To manage other 301's and to turn on and off redirections for single pages, I use:
Wordpress Redirection:
http://wordpress.org/plugins/redirection/
This will allow you to add 301's for other urls. This also allows you to import a CSV. I have created a CSV with the list created with the above Plugin and imported into this for better management.
I have also turned off "monitoring" in the options section (Don't monitor) so that it will not accidentally create a bunch of unnecessary redirects. For example, if you create a blog post with this url: ...com/test/ and change it to ...com/test2/ it will automatically create a redirect. This means that later in the future, if you create a page ...com/test/ you will not be able to view it. It will always redirect to ...com/test2/. This kind of automation can be troubling if you forget this monitoring is on.
Hope this helps.
If anyone knows of a better way to automate any missing page from a particular directory, please let me know.

Two domains on same WP site, but different header

I'm using Wordpress for a client's website and this client asked me if he could have two domains with the same content, but a different logo on top of the page. So for example:
www.website1.com with logo1
www.website2.com with logo2
Both with same theme & contents.
I was thinking of a double WP install, but then you have to do every change two times. I read something about multisites in Wordpress, but could not find out how to do this.
I hope someone can help me out, thanks!
On the SEO front this is a bad idea, you will duplicate all content Google won't know what to value more. But if you really want it.
you could do this with two wp install's but there are problems.
First set your site url's in the wp-config
Second let both installs connect to the same database. The change in
header can be detected with $_REQUEST (google it)
Now there are 2 problems left which I don't know how to fix.
The uploads folder need to be synchronized so each site can access the uploads
the solution will be with simlinks stuff. (which I'm not familiar with)
And your hosting provider has to allow it.
If you add an internal link in your post/pages it will prepend the complete site url, and save this hard coded in the database.
The solution of this could be in the editor, of to filter the content before it is printed.
If you want to go this way I'm willing to look further into these problems
Here is a relatively recent article on how to set a multisite wordpress network up.

WordPress with Yahoo! Hosting... Almost there

EDIT:
Yeah, so this problem is really unsolvable. Yahoo prevents access to .htaccess, even from WordPress itself trying to change it. I had to settle for writing a script on the default homepage that redirects browsers to "www.abc.com/index.php" if they go straight to "www.abc.com". You always have to deal with "index.php" being in the address bar but it's better than not having permalinks...
/EDIT
Yahoo! Small Business hosting seems specifically engineered to make WordPress difficult-- but it's my client's host and there's not much I can do about it. I'm trying to move WordPress into the root directory, and I'm sooo close to having it done.
I've read and read and read about how to get the Permalinks to work right, and since Yahoo! hosting doesn't let you modify htaccess I am pretty much up s*** creek. I'm using the simple permalink structure of "/%postname%/", which once I moved to the root, stopped working. I have changed it to "/index.php/%postname%/", which allows you to see the pages if you manually type in index.php before the page name or if you are logged into the admin area and "View Page". Also, the correct permalink shows on all of the pages in the editor.
However, WordPress doesn't let you change the permalink of the static page you use as the front page.
Long story short, if I go to "www.abc.com/index.php", the links in the menu all work fine. However, if I just got to "www.abc.com", the links don't pick up the "index.php" from the permalink structure. I need to fix this, so if anyone knows how to either:
Change the permalink of the static front page
Fix something in the database if I install PhpMyAdmin
Work around not having access to .htaccess
Put a small script somewhere on the index page to append "index.php" to the url
Any other suggestions
It seems it would work if I was NOT using a static front page but rather the blog, but this isn't an option. I've tried changing the "Tag base" setting to no avail, as well as deactivating the Yahoo! Custom Permalinks plugin (and reactivating it again after that failed...). Could really use some help!
Check out Giving Wordpress its own directory. I can see how this could solve your problem. Also make sure that you have done the obvious, and change your url for WordPress address (URL) Site address (URL) inside the general settings page. Perhaps the static homepage should be developed outside of wordpress, and then you can follow the steps provided in the link I provided. Hope this solves your issue.
Yahoo doesn't allow users access to the htaccess file which means that you can't the mod_rewrite rules needed for custom permlinks. The Only way around it that i've heard it works (never tried it myself) is to add /index.php/ to the beginning of your custom structure so: Go to Permalink Settings > Select Custom Structure. And set the value as /index.php/%postname%/ or what ever you want as long as you add /index.php/ before it.
Hope this helps.
I had a similar problem with this host (in 2018! 4 years after your question) that I finally solved by changing the permalink settings.
Settings > Permalink Settings > Custom Structure: /index.php/%postname%/
I wish there was a better solution but Yahoo Small Business still doesn't allow .htaccess files - after several frustrating rounds with customer service, I finally admitted defeat and used this work around.

Wordpress, why doesn't my blog load the posts if U use the /subfolder domain method?

I have a blog at http://hamids-it.elaosta.com amongst others. If I try to access it from
http://elaosta.com/hamids-it it loads the blog but says it couldn't find the page I wanted.
How do I fix this so I can use either?
I'm guessing you have a standard subdomain install, whereby http://subdomain.example.com is mapped to the directory /example.com/public_html/subdomain?
In any normal circumstance, say with a static HTML file, you can rightly access the same resource at both example.com/subdomain/resource.html and subdomain.example.com/resource.html.
However, in your case, WordPress is parsing the REQUEST_URI and using it to determine what to show.
So in the case of http://elaosta.com/hamids-it, WordPress is actually looking for a page 'hamids-it' - and if it doesn't find it, voila, your 404.
The fix?
You'll need to decide which way you want to access your blog, subdomain or sub-directory, then stick to it.
When you've made a choice, update your General settings in WordPress admin and set both address URL's to either http://hamids-it.elaosta.com or http://elaosta.com/hamids-it.

Resources