Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have WordPress at address http://www.example.com/blog/, now I want it to be accessible as http://www.example.com/ without moving wordpress to root directory.

I have made appropriate .htaccess changes.

wp-config.php:

define("WP_HOME", "http://{$_SERVER["HTTP_HOST"]}");
define('WP_CONTENT_DIR', $_SERVER["DOCUMENT_ROOT"] . "/blog/wp-content");
define('WP_CONTENT_URL', "http://{$_SERVER["HTTP_HOST"]}/blog/wp-content");

One thing that doesn't work is WordPress uses www.example.com/wp-includes/ instead of www.example.com/blog/wp-includes/

There are even includes like www.example.com/%post-name%/wp-includes/js/jquery/jquery.js?ver=1.7.2

I have fixed it through .htaccess:

RewriteRule wp-includes/(.*) /blog/wp-includes/$1 [L]

Is threre a better way?

share|improve this question
    
I gave up. I think wordpress does not support using it this way. –  Stancell Sep 27 '12 at 8:33
    
Full tutorial how to do that is here codex.wordpress.org/Giving_WordPress_Its_Own_Directory –  Stancell Sep 28 '12 at 8:28
add comment

1 Answer

up vote 0 down vote accepted

Add to wp-config.php:

define('WP_SITEURL', 'http://example.com/blog/');

On the codex.
This is all you need.

share|improve this answer
    
I want WP_SITEURL to be example.com That is where the problem comes from. –  Stancell Sep 27 '12 at 8:32
    
Read the documentation WP_SITEURL will only point to the folder where the WP files are. WP_HOMEURL points to the website in the browser. –  janw Sep 27 '12 at 8:39
    
Thanks, you pointed my error. I used site_url() in many places and that is the reason it didn't work for me. –  Stancell Sep 28 '12 at 8:30
    
If my answer is the solution accept my answer –  janw Sep 28 '12 at 10:08
    
Full solution - codex.wordpress.org/Giving_WordPress_Its_Own_Directory –  Stancell Sep 28 '12 at 10:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.