How to have wordpress point to a different directory - wordpress

wordpress installation is at: http://www.domain.com/mainpage
but I want people to access this via http://www.domain.com
How can I accomplish this ?

Redirect your users from your index.php file to the path where you want them to go.
using header("Location:YOUR_PATH");

You need to do two things (3 if you have fancy URLs).
First. Go to the settings panel in WordPress. Make the "Site Address" http://www.domain.com. Leave the "WordPress Address" alone -- it should remain http://www.domain.com/mainpage/
Second. Copy index.php from mainpage/ and place the copy in your root directory for www.domain.com. Change:
require('./wp-blog-header.php');
To:
require('./mainpage/wp-blog-header.php');
If you're using pretty URLs you may have to copy .htaccess as well -- Wordpress usually can do this for you when you change the Site Address.

Related

Change WordPress URL folder name to another without redirecting

I'm trying to change my WordPress site's URL (without redirecting) from:
example.com/go/take/
to:
example.com/go/give/
Also, if my wordpress site is located in the /go/ folder, is it possible for me to trim /go/ ?
Thank you.
These are two separate issues.
Regarding the first issue, are you saying that you still want a user
to type in example.com/go/take, but be served the file from
example.com/go/give without changing the url? You can install the
wordpress redirection plugin to do that. You can create a 'pass
through' redirect which will do this.
Here's what you can do to run example.com from a wordpress install
in the go subdirectory:
http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory

Wordpress - subdomain to root

I've been building a wordpress site on a subdomain while having my old website in the root directory. Now I have finished the site and would like to move it into the root. Is there a way how to 'redirect' my site so I don't need to move all the files and databases from the subdomain? The address should appear as www.myweb.com, though.
I have these folders in my FTP:
public_html, _sub, tmp
The subdomain is currently located at _sub/wc/
Thanks!
This codex article should explain the process, I've used it successfully myself several times: http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory#Using_a_pre-existing_subdirectory_install
According to wordpress you can leave your files where they are and put the following into your wp-config file:
define('WP_SITEURL', 'http://www.example.com/new/');
define('WP_HOME', 'http://www.example.com/new/');
Or you can:
In the box for WordPress address (URL): change the address to the new
location of your main WordPress core files. Example:
http://example.com/wordpress
In the box for Site address (URL): change
the address to the root directory's URL. Example: http://example.com
Take a look at moving wordpress: Moving_WordPress and editing the wp-config Editing_wp-config.php as well as Giving_WordPress_Its_Own_Directory
Wordpress gives a lot of information about moving domains etc, and it is well worth reading their documentation on the matter.
You may want to remove your old website files (it is good to have a back up of the old version anyway) so that they do not conflict (esp if they are WordPress).

Pass through wordpress Folder to root folder

I have a wordpress installation on a site. It was placed inside ~/wp.
I've moved it yesterday to the root folder, ~/. However, a lot of the theme references and images still point out to ~/wp.
Instead of finding all these places(which may be hundreds), I'd like to pass through ~/wp to the root folder. Meaning, when the user goes to http://www.site.com/wp/thing.php , he'll actually be inside ~/thing.php, without changing the url.
Would this be possible with .htaccess changes? and if so, how?
It's a config setting - in Settings -> General you are given two options, WordPress Address (URL) and Site Address (URL).
You have the former pointing at the directory with the Wordpress installation in it and the latter at the root of your site.
Here's the Codex info on it;
http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory#Using_a_pre-existing_subdirectory_install
Incidentally, modifying all the files paths is another option of course - you would use the same technique you would use when transferring a Wordpress site from localhost to live, or from a dev server to live. You can look at the second part of my answer in this thread;
How to push wordpress from mamp into hostgator
That interconnectit script is a huge timesaver when moving WP sites.

wp-admin and wp-login.php - 404 error for those who do not administrator (wordpress + htaccess)

I try to hide the traces as wordpress on my website for security reasons. Does anyone know how to create a rule using htaccess, according to which a third party user (with a different ip) redirected to on /404.php if he visits the wp-admin and wp-login.php ... I've seen third-party plug-ins (?) To address this problem, but I do not want to create an extra load on the CMS.
you can use simple redirect in .htaccess like this
Redirect 301/wp-admin/ http://www.yourwebsite.com/404.php
But if you're trying to completely hide wordpress it requires a little bit of technical work...what I did in mine, is search every files in the wp-include and wp-content folder as well as the root folder that contained the wp-login.php and /wp-admin/somefolder words, and change everything to a file or folder to a name of your choice that no-one can guess. Although you have to be very careful as not to change an important code there...

remove /blog sub from wordpress permalinks

Any idea? Im using wordpress as a CMS (not a blog) and I would like to change the default "blog" subdirectory in something like "news".
Thanks
WP Version 3
This probably means you've installed workpress in the yoursite.com/blog directory - for example, if you ftp into your site, you'll see the / folder listed, which is the base directory of your site. Anything in this folder will be served as yoursite.com/somefile.html. However, installing wordpress in the /blog directory means everything served from wordpress will look like yoursite.com/blog/wp-admin, for example.
If you change the name of that subdirectory to news, that would solve your problem. Keep in mind, however, that some things inside wordpress will be configured to use that blog directory as the home directory, and simply renaming it might cause unexpected problems.
Hope this helps.
PS - if you actually point us at your site, or give a little bit more technical information about your directory structure, we might be able to help more specifically.
Find a way to rename the "blog" directory, where you installed WordPress to.
a. One way could be an FTP client you're using.
b. Another way could be the File Manager in your web host's control panel.
But DO NOT RENAME IT YET.
Log in to your WordPress Dashboard.
Go to "Settings > General" in the left set of options.
Change "WordPress address (URL)" from "http://yourdomain/blog" to "http://yourdomain/news"
(Don't hit "Save Changes" yet...)
Make a similar change to "Site address (URL)"
Click "Save Changes"
Go rename the "blog" directory to "news"
Now visit your site and see what happens.
If you have already added posts with images and such, there will be links in your posts that contain the old "/blog/" part of your path. You will need to update those posts.
Good luck.
Paul
There is a plugin named "Custom Taxonomies". You can use it.
http://wordpress.org/extend/plugins/custom-taxonomies/
You can do it from .htaccess adding this:
RewriteRule ^index\.php/blog/(.+)$ http://www.example.com/index.php/news/$1 [R=301,L]

Resources