Discussion:
MultiSite Localhost subdomain redirect issue
Duncan O'Neill
2013-07-26 19:34:50 UTC
Permalink
Hi all,

I know this is a well-chewed over topic, but despite trawling forums
over days, I haven't been able to find a topic which gives me an answer.
I've also posted this on the WordPress forums, but received no replies.

I've set up multisite on localhost on Windows using XAMPP.

The problem is a redirect loop when I try to login to my sub-domain
dashboards. I can see the test sites themselves at test.xp-home, and
test2.xp-home, etc. I can login to the main dashboard at xp-home.

Up until this, I'd just been doing separate installs for each build, and
adding the subdomain to httpd-vhosts.conf, and editing my hosts file.
That's worked fine, but I'm trying to streamline things so that I can
manage plugins and themes centrally.

This is a sample of my hosts file;

( xp-home is the name of my local machine )

============================
127.0.0.1 localhost
.
127.0.0.1 xp-home
.
.
127.0.0.1 test.xp-home
127.0.0.1 test2.xp-home
=============================

This is my .htaccess file under the web root;

================================
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ wp/$1 [L]
RewriteRule . index.php [L]
==================================

This is a sample of my vhosts file;

====================================
<VirtualHost *:80>
DocumentRoot "C:/Users/admin/Documents/web"
ServerName xp-home
#ServerAlias xp-home *.xp-home
<Directory "C:/Users/admin/Documents/web">
AllowOverride All
Options +MultiViews +FollowSymLinks
</Directory>
ErrorLog logs/error.log
CustomLog logs/access.log combined
</VirtualHost>
====================================

and at the bottom....

====================================
<VirtualHost *:80>
DocumentRoot "C:/Users/admin/Documents/web"
ServerAlias *.xp-home
ErrorLog logs/error.log
CustomLog logs/access.log combined
</VirtualHost>
======================================

Can someone please point out what I'm doing wrong here?

Many thanks in advance,
--
Duncan O'Neill
http://urbanlegendweb.co.nz/
mob:+64 27 385 8086
skype: maxwell_s
Jeff Morris
2013-07-26 21:23:57 UTC
Permalink
Post by Duncan O'Neill
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
Try:

RewriteRule ^wp-admin$ /wp-admin/ [R=301,L]

Leading slash on the target.
--
Jeff Morris
Kent, UK.
Duncan O'Neill
2013-07-26 22:55:53 UTC
Permalink
Post by Jeff Morris
Post by Duncan O'Neill
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteRule ^wp-admin$ /wp-admin/ [R=301,L]
Leading slash on the target.
Hi Jeff,

thanks for taking the time to help.

I tried the changing the rewrite rule as you suggest,
but same problem.

Any more / other suggestions gratefully received.

best,
--
Duncan O'Neill
http://urbanlegendweb.co.nz/
mob:+64 27 385 8086
skype: maxwell_s
Jeff Morris
2013-07-27 06:59:33 UTC
Permalink
Post by Duncan O'Neill
Any more / other suggestions gratefully received.
OK. Try adding a leading slash to your other RewriteRule targets, too.
--
Jeff Morris
Kent, UK.
Jeff Morris
2013-07-27 07:33:48 UTC
Permalink
Post by Duncan O'Neill
thanks for taking the time to help.
Actually, I can see a few issues with your rule set. It seems to have
little in common with a standard WP set.
It might help if you could re-post it with #comments interleaved to
describe the logical order (and the effect of the flags). I think all
will become clear.
--
Jeff Morris
Kent, UK.
Loading...