Redirecting domain to WordPress subdirectory

0

I am using Wordpress to create a website for an author friend. The website is www.essex-history.com with wordpress installed at www.essex-history.com/wordpress

If I set up 301 redirection of the (GoDaddy) domain to the /wordpress directory (using cPanel), the wordpress pages fail to open with a 'too many re-directs'.

In Wordpress, in Settings/General, the entry in both the Wordpress Address and Site Address fields points to www.essex-history.com/wordpress. (However, changing the Site Address entry to reflect '/wordpress' or not doesn't seem to make any difference at all.)

Some time ago I managed to make www.utting.org point successfully to www.utting.org/site (the wordpress folder), but I can't replicate what I did!

All I need to do is to get www.essex-history.com to point to www.essex-history.com/wordpress !

Thanks, Nigel

user277524

Posted 2014-01-20T21:19:27.297

Reputation: 43

Answers

0

You must turn of the redirect at Godaddy.

You are redirecting twice. First you're redirecting, via Godaddy, the whole domain name to the actual subdomain, www.essex-history.com/wordpress. So, if the main domain exxex-history.com redirects to a redirect, then yes, you will get an error.

There are two ways to make this work the way you want it to.

First, like codenoir said, add the html page with the code

OR

Alternatively, you could do a php redirect by creating an index.php file and adding the following code to it:

<?php
// PHP permanent URL redirection
header("Location: http://www.essex-history.com/wordpress", true, 301);
exit();
?>

Gregory Smitherman

Posted 2014-01-20T21:19:27.297

Reputation: 471

0

First: As others have said - turn off your GoDaddy redirect. Get the settings for your website/hosting back to how you originally received them because they just work!

Why didn't you read the WordPress Codex pages???? They have the answer to exactly what you want.

https://codex.wordpress.org/Giving_WordPress_Its_Own_Directory#Method_II_.28With_URL_change.29

Moving process

(p.s. If you've already installed WP in subdirectory, some steps might be already done automatically).

  1. Create the new location for the core WordPress files to be stored (we will use /wordpress in our examples). (On linux, use mkdir wordpress from your www directory. You'll probably want to use chown apache:apache on the wordpress directory you created.)

  2. Go to the General Screen.

  3. In WordPress address (URL): set the address of your main WordPress core files. Example: http://example.com/wordpress

  4. In Site address (URL): set root directory's URL. Example: http://example.com

  5. Click Save Changes. (Do not worry about the errors that happen now! Continue reading)

  6. Now move your WordPress core files (from root directory) to the subdirectory.

  7. Copy (NOT MOVE!) the index.php and .htaccess files from the WordPress directory into the root directory of your site (Blog address). The .htaccess file is invisible, so you may have to set your FTP client to show hidden files. If you are not using pretty permalinks, then you may not have a .htaccess file. If you are running WordPress on a Windows (IIS) server and are using pretty permalinks, you'll have a web.config rather than a .htaccess file in your WordPress directory. For the index.php file the instructions remain the same, copy (don't move) the index.php file to your root directory. The web.config file, must be treated differently than the .htaccess file so you must MOVE (DON'T COPY) the web.config file to your root directory.

  8. Open your root directory's index.php file in a text editor

  9. Change the following and save the file. Change the line that says: require( dirname( __FILE__ ) . '/wp-blog-header.php' ); to the following, using your directory name for the WordPress core files: require( dirname( __FILE__ ) . '/wordpress/wp-blog-header.php' );

  10. Login to the new location. It might now be http://example.com/wordpress/wp-admin/

  11. If you have set up Permalinks, go to the Permalinks Screen and update your Permalink structure. WordPress will automatically update your .htaccess file if it has the appropriate file permissions. If WordPress can't write to your .htaccess file, it will display the new rewrite rules to you, which you should manually copy into your .htaccess file (in the same directory as the main index.php file.)

Personally, I'd start from scratch by using the GoDaddy cPanel to install WordPress to your custom directory so that you have to get to it by typing the full URL, then follow the steps above. You'll then have a clean install knowing what you want to do will work from the get go.

Kinnectus

Posted 2014-01-20T21:19:27.297

Reputation: 9 411

Old question, but needs a detailed answer for future readers – Kinnectus – 2017-06-23T12:09:50.790

0

Turn off the godaddy redirection. Make a single html page in the home directory of the site that looks like this:

<html>
<head>
<meta http-equiv="refresh" content="; url=http://example.com/">
</head>
</html>

http://en.wikipedia.org/wiki/Meta_refresh

Xavier J

Posted 2014-01-20T21:19:27.297

Reputation: 640

thanks. What should I call the file? Does it need a specific name? Presumably, example.com in your code example should be replaced by the address of my wordpress directory? – user277524 – 2014-01-20T22:23:37.353

Usually index.htm or index.html – Xavier J – 2014-01-20T23:22:58.997

Have created index.html (in public_html which is where web pages on godaddy sites should live) with the content you suggested but the browser is not acting on the content of the file (and redirecting), it is just displaying the text of the html file on screen. I have the correct <html> and <head> tags. Any ideas? Thanks. – user277524 – 2014-01-21T10:52:24.633