Forum Moderators: phranque
Now a couple of days ago I moved my Wordpress index file from a subdirectory ("blog") into the site root. That went well except that my wife's site is no longer working properly. The site comes up without styling and she can't log in to the admin area (which comes up as a 404).
Presumably there's something I need to change in the htaccess, which is in my site's root. Any idea what that might be?
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress
RewriteEngine On
RewriteCond %{HTTP_HOST} example.com$ [NC]
RewriteCond %{REQUEST_URI} !^/example/.*$
RewriteRule ^(.*)$ /example/$1
You can also delete the <IfModule> - </IfModule> container pair, as it does nothing useful. Then delete the second "RewriteEngine on" as well, for the same reason.
If that doesn't help, then we'll need to know several things in order to help:
1) Please give an example URL for your blog (use example.com as the domain).
2) Please give an example URL for her blog (use example.org as the domain if different from yours).
3) Please give the corresponding server filepath for the URL in (1) above.
4) Please give the corresponding server filepath for the URL in (2) above.
(1) and (2) are what you'd type into the browser address bar to see a blog posting. (3) and (4) are the path to the files on the server -- like what you see when you navigate the site using FTP. Please note that we do not allow "personal" URLs to be posted here --for your good and ours-- so that's the reason for my request that you use "example.com" (and "example.org" if needed).
Thanks,
Jim
However I'd rather not futz with the Wordpress code since Wordpress will (I think) overwrite any changes anytime I update my permalinks. If I'm wrong about that please let me know.
1. A sample URL from my site would be www.example.com/blog/wp-content
2. A sample URL from my wife's blog would be www.example.net/wp-content
3. The corresponding filepath for (1) above would be htdocs\www\blog\wp-content
4. The corresponding filepath for (2) above would be htdocs\www\example\wp-content
Thanks again for your help. I'm kind of embarrassed about having blown up my wife's site!
No need to put anything in root
htdocs\www\
Code for htdocs\www\blog\.htaccess
---------
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</IfModule>
# END WordPress <IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /example/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /example/index.php [L]
</IfModule>
# END WordPress
1. A sample URL from my site would be www.example.com/blog/wp-content
2. A sample URL from my wife's blog would be www.example.net/wp-content
3. The corresponding filepath for (1) above would be htdocs\www\blog\wp-content
4. The corresponding filepath for (2) above would be htdocs\www\example\wp-content
RewriteEngine on
#
# Canonicalize my domain name
# If requested hostname contains "example.com" (any case)
RewriteCond %{HTTP_HOST} example\.com [NC]
# but isn't *exactly* "www.example.com" (must be www and lowercase, with no appended dot or port numbers)
RewriteCond %{HTTP_HOST} !^www\.example\.com$
# then redirect to canonical domain
RewriteRule (.*) http://www.example.com/$1 [R=301,L]# Canonicalize darling's domain name
RewriteCond %{HTTP_HOST} example\.net [NC]
RewriteCond %{HTTP_HOST} !^www\.example\.net$
RewriteRule (.*) http://www.example.net/$1 [R=301,L]
#
# Darling's site (assuming it has its own .htaccess file at /example/.htaccess)
RewriteCond %{HTTP_HOST} ^www\.example\.net
RewriteCond %{REQUEST_URI} !^/example/
RewriteRule (.*) /example/$1 [L]
#
# My site
# BEGIN WordPress
RewriteCond %{HTTP_HOST} ^www\.example\.com
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress
Again, the <IfModule> container is a waste of space and CPU time -- all it does is make the WP code fail silently if mod_rewrite is not installed -- and I think that's a really dumb idea as a debugging technique... I susp[ect this was forced on the WP developers by hosting companies that don't support users' .htaccess files or mod_rewrite.
Jim
I should have explainedmore clearly that I have the innards of Wordpress in my /blog directory and the .htaccess and index.php files in the root. So wp-admin, wp-content, etc are in htdocs\www\blog\, while people see Wordpress as starting in the root and never see anything in the /blog directory.
Previously I had Wordpress running in the /blog directory (i.e. I had the .htaccess and index.php files there) and people saw a url like www.example.com/blog/archives/this-is-a-post. Now they just see www.example.com/archives/this-is-a-post, even though the Wordpress files are still in the /blog directory.
Anyway, thanks again. I'm bowled over by your generosity and expertise.