2014-08-30 4 views
1

Интересно, может ли какая-то душа помочь мне.htaccess redirect - конфликт в WordPress

Я создал новый сайт WordPress в подкаталоге под названием 'wp'. Вместо того, чтобы перемещать все (что я не совсем понимаю, как это сделать), я хотел бы просто перенаправить главную страницу, то есть http://www.example.com, чтобы указать на http://www.example.com/wp/ и для всех загружаемых страниц из этого подкаталога мигает/wp/в адресной строке ,

В соответствии с инструкцией от моего веб-хостинга, я добавил этот код перенаправления к .htacess файла:

# 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] 

Однако это не работает, и мой веб-хостинга, которые не будучи очень полезным, скажите мне, что некоторый существующий код, созданный WordPress, противоречив. Это существующий код в файле .htaccess:

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> 

Я использую пермалинки, Интересно, что это вызывает ли проблему. Может кто-нибудь, пожалуйста, сообщите мне, где находится конфликт и как его исправить?

+0

В RewriteCond% {HTTP_HOST}^(WWW.)? Example.com, вы изменили example.com на ваше доменное имя? –

+0

Да, я изменил example.com на свое доменное имя. Но, его не работает –

+0

Я вижу, что ваша проблема решена уже, поэтому я не рассматриваю ее сейчас! –

ответ

1

Ваш RewriteBase в /wp/.htaccess неверен (так что ваше правило).

В этом файле заменить эту часть

<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> 

этим одним

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase /wp/ 

RewriteRule ^index\.php$ - [L] 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule . index.php [L] 
</IfModule> 
+0

Отлично, теперь он работает отлично. Спасибо –