I wonder if some kind soul can help me.
I have built a new WordPress site in a sub directory called ‘wp’. Rather than moving everything (which I don’t fully understand how to do) Id like to simply redirect the main page i.e. http://www.example.com
to point to http://www.example.com/wp/
and for all pages to load from within that sub directory minues the /wp/ in the address line.
As per instruction from my web host I have added this redirect code to the .htacess file:
# Justhost.com
# .htaccess main domain to subdirectory redirect
# Copy and paste the following code into the .htaccess file
# in the public_html folder of your hosting account
# make the changes to the file according to the instructions.
# Do not change this line.
RewriteEngine on
# Change example.com to be your main domain.
RewriteCond %{HTTP_HOST} ^(www.)?example.com
$
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteCond %{REQUEST_URI} !^/wp/
# Don't change these line.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# Change 'subdirectory' to be the directory you will use for your main domain.
RewriteRule ^(.*)$ /wp/$1
# Change example.com to be your main domain again.
# Change 'subdirectory' to be the directory you will use for your main domain
# followed by / then the main file for your site, index.php, index.html, etc.
RewriteCond %{HTTP_HOST} ^(www.)?example.com$
RewriteRule ^(/)?$ wp/index.php [L]
However this is not working and my web host, who are not being very helpful, tell me that some existing code generated by WordPress is conflicting. This is the existing code in the .htaccess file:
DirectoryIndex index.html index.shtml index.xhtml index.wml index.perl index.pl index.plx index.ppl index.cgi index.jsp index.js index.jp index.php4 index.php3 index.php index.phtml index.htm home.htm default.htm index.fcgi default.html
# -FrontPage-
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>
AuthName zsr-art.org.uk
AuthUserFile /home/zsrarto1/public_html/_vti_pvt/service.pwd
AuthGroupFile /home/zsrarto1/public_html/_vti_pvt/service.grp
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /index.php/
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php/index.php [L]
</IfModule>
I’m using permalinks, I wonder whether this is causing a problem. Could someone please advise me as to where the conflict is and how to fix it?
Your
RewriteBase
in/wp/.htaccess
is wrong (so your rule is).In that file, replace this part
by this one