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.

My website file structure is like this:

index.php
wp/wp files ...

In general in Site Address (URL) I have ...site.com

In index.php I have:

    define('WP_USE_THEMES', true);
    require('./wp/wp-blog-header.php');

Everything works fine but for wp-admin i have ...site.com/wp/wp-admin/

My question is: Can I change the url for wp-admin also to have ...site.com/wp-admin/?

share|improve this question
    
As in move the location of wp-admin, or as in rewrite the URL? –  m0r7if3r May 2 '12 at 12:52
    
wp-admin is at wp/wp-admin and I want to remove from url the wp/ part. I am happy with a rewrite rule also just to not be hard coded with website name. –  Alqin May 2 '12 at 13:37
add comment

2 Answers

You should be able to regex it with /wp/(wp-admin/.*) and point that to /$1, thus removing the /wp/. You can do this either via .htaccess or via wordpress' rewrite API.

share|improve this answer
add comment

if you're happy with a rewrite rule:

in .htaccess:

RewriteRule   ^wp/(.+)$   $1   [nocase,redirect=temp,last]

if might work without the [redirect] flag.

if you want to be very specific:

RewriteRule   ^wp/(wp-admin/.*)$   $1   [nocase,redirect=temp,last]

within WP (the rewrite will need to happen before permalink rewrites, etc):

add_action( 'init', 'gregory_rewrite_wpadmin' );
function gregory_rewrite_wpadmin()
{
    add_rewrite_rule(
        '^wp/(wp-admin/.*)$',
        '$matches[1]',
        'top' );
}

not tested, but trying it won't hurt you ;-)

cheers,
Gregory

share|improve this answer
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.