Avi Kehat
Avi Kehat

Reputation: 103

Apache2 rewrite working selectively

I have the following 2 identical lines in my .htaccess file

RewriteRule ^admin(.*)$ http://admin.abc.com/$1 [R=301,L,NC]
RewriteRule ^portal(.*)$ http://portal.abc.com/$1 [R=301,L,NC]

abc.com/portal - redirects nicely to portal.abc.com .

However - abc.com/admin - redirects to admin.abc.com/admin .

Note: The root directory has a WordPress installation. IN order to cancel the redirection of admin to wp-admin, I added the following line to the theme's function.php:

remove_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );

Is that the issue?

(The quoted 2 RewriteRules are the first 2 lines in the .htaccess, right after "RewriteEngine On")

Thanks

Upvotes: 1

Views: 27

Answers (1)

user2493235
user2493235

Reputation:

Those rules can't be doing that. I think you need to clear your browser cache and then you will find it works as you expect. You have some previous test result cached in your browser.

Upvotes: 1

Related Questions