2

I have WordPress setup in root, but I have a sub-folder that is not related to WordPress as well. I just moved servers, so before if I went to .com/admin/ I would get that subfolder. Now, I (and others) get redirected to .com/wp-admin/ (or asked to login with a planned redirect to wp-admin).

I thought the server/Apache would first say "Oh, here's the folder/file for you, no need to bother with this .htaccess, thanks!" and not "Oh, I have to run through this .htaccess and oh you match this wordpress so you get redirected to the /index.php, thanks!" (Root index.php is WordPress.)

The .htaccess in the root location is the standard WP rules and WP-Supercache Rules.

order allow,deny
#ip blocking
allow from all

Options -MultiViews
RewriteEngine on

# BEGIN WPSuperCache
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#If you serve pages from behind a proxy you may want to change 'RewriteCond %{HTTPS} on' to something more sensible
AddDefaultCharset UTF-8
RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{HTTPS} on
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz -f
RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html.gz" [L]

RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{HTTPS} !on
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz -f
RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html.gz" [L]

RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTPS} on
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html -f
RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index-https.html" [L]

RewriteCond %{REQUEST_URI} !^.*[^/]$
RewriteCond %{REQUEST_URI} !^.*//.*$
RewriteCond %{REQUEST_METHOD} !POST
RewriteCond %{QUERY_STRING} !.*=.*
RewriteCond %{HTTP:Cookie} !^.*(comment_author_|wordpress_logged_in|wp-postpass_).*$
RewriteCond %{HTTP:X-Wap-Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTP:Profile} !^[a-z0-9\"]+ [NC]
RewriteCond %{HTTPS} !on
RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html -f
RewriteRule ^(.*) "/wp-content/cache/supercache/%{SERVER_NAME}/$1/index.html" [L]
</IfModule>

# END WPSuperCache


# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

# END WordPress

There is an .htaccess in the /admin/ location as well, with a .htpasswd setup as well.

AuthGroupFile /dev/null
AuthName "Administration"
AuthType Basic
AuthUserFile /home/.../public_html/admin/.htpasswd
require valid-user

I'm using Apache 2. My previous server was on litespeed. My host's solution to allow access to the /admin/ folder was to rename the .htaccess. While that worked, it completely broke everything on the WordPress side (duh).

My problem is similar to .htaccess - how to tell wordpress to ignore a directory but my folder is already not an SEO friendly URL or related to anything within WordPress.

6
  • Is it possible for you to use different host names for the wordpress content and the rest? Feb 14, 2013 at 15:03
  • Why? If he can do that it would solve his problem. Feb 14, 2013 at 15:55
  • @HaukeLaging Yes, I could use a .net/admin/ for that aspect and leave the .com alone. How would I set that up to have .net point to that subfolder?
    – MECU
    Feb 14, 2013 at 18:30
  • You either take the directory "admin" out of the wordpress documentroot (the clearer solution IMHO) or configure the admin directory as the documentroot for the new hostname (new vhost file) if the content there does not depend on a "/admin/" URL structure or you even point the documentroot to the wordpress documentroot. Without any alias or url rewrite configuration the directory content should be delivered as usual. May make sense to block access to everything that is not under /admin. Feb 14, 2013 at 18:38
  • @HaukeLaging Completely moving the admin folder into a .net account setup with WHM seemed to do the trick. I'm fortunate that I already owned another domain name and have a dedicated server so file/path restrictions can otherwise be ignored. If you want to put this as an answer, I'll select it.
    – MECU
    Feb 15, 2013 at 4:17

0

You must log in to answer this question.

Browse other questions tagged .