WordPress在子目录wp-admin中出现问题

时间:2013-11-26 作者:OZZIE

我在网站的子目录中安装了WordPress 3.3.1,用作临时测试站点。似乎是根站点.htaccess 正在为Wordpress wp管理页创建问题。我已经设置了WordPress Address (URL)Site Address (URL) 正确指向子目录url。

如果我没有.htaccess 在我的子目录内(wp root)=wp admin(登录页)工作。

如果我添加.htaccess 如下图所示,该页面可以正常工作,如果您登录到wp admin,则可以正常工作BUT 每次尝试保存内容时=空白页,如果aren\'t 登录并尝试登录=空白页。

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subcataloged/cliens-wp/

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

# END WordPress
总结:[.htaccess in wp root(www.domain.com/sub/cat/)]=站点(wp admin除外)按预期工作。

[无htaccess]==站点CSS、图像、js被错误地重写到根文件夹,Wp admin工作正常。

我如何解决这个问题?是否有.htaccess 对于WP 3.3.1,我可以使用?

这是我的.htaccess 对于我的OTHER WEB ROOT 现场(非WP):

Header unset Pragma
FileETag None
Header unset ETag

# cache images/pdf/css/js docs for 10 days = 864000, 31536000 = 1 year
<FilesMatch "\\.(ico|pdf|jpg|jpeg|png|gif|js|css)$">
  Header set Cache-Control "max-age=31536000, public, must-revalidate"
  #Header unset Last-Modified
</FilesMatch>

# cache html/htm/xml/txt diles for 2 days
<FilesMatch "\\.(html|htm|xml|txt|xsl)$">
  Header set Cache-Control "max-age=7200, must-revalidate"
</FilesMatch>

#Gzip
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/javascript text/css application/x- javascript application/javascript image/x-icon
</ifmodule>
#End Gzip


# -FrontPage-
RewriteEngine on
RewriteBase /

#Gamla sidor gör rewrite till nya:
RewriteRule ^nyheter/$ %{SCRIPT_URI}senaste-projekt/ [R]
RewriteRule ^webben/$ %{SCRIPT_URI}tips-for-webben/ [R]
###

RewriteRule ^utvalda-projekt/$ / [L]
RewriteRule ^senaste-projekt/$ %{SCRIPT_URI}index.php [L]
RewriteRule ^webbportfolio/$ %{SCRIPT_URI}views/webbport.php [L]
RewriteRule ^universitetet/$ %{SCRIPT_URI}views/uniport.php [L]
RewriteRule ^kontakta-mig/$ %{SCRIPT_URI}views/kontakt.php [L]

RewriteRule ^presentation/$ pres.php [L]
RewriteRule ^tips-for-webben/$ webben.php [L]
RewriteRule ^CV/$ views/cv.php [L]
RewriteRule ^CV-en/$ views/cv_en.php [L]

RewriteRule ^goeco/$ goeco.php [L]
RewriteRule ^eld/$ fire.php [L]
RewriteRule ^movie-night/$ movienight/ [R]


RewriteRule ^webbtutorials/$ tutorials.php [L]
RewriteRule ^sokhjalp/$ search.php [L]
RewriteRule ^valj_ratt_webblasare/$ valja_webblasare.php [L]
RewriteRule ^mina_bloggar/$ blog.php [L]

RewriteRule ^(.*)/lightbox/css/(.+)$ %{SCRIPT_URI}/lightbox/css/$2 [R]
RewriteRule ^(.*)/lightbox/js/(.+)$ %{SCRIPT_URI}/lightbox/js/$2 [R]
RewriteRule ^(.*)/portfolio/(.+)$ %{SCRIPT_URI}portfolio/$2 [R]
RewriteRule ^(.*)/css/(.+)$ %{SCRIPT_URI}css/$2 [R]
RewriteRule ^(.*)/img/(.+)$ %{SCRIPT_URI}/img/$2 [R]
RewriteRule ^(.*)/grafik/(.+)$ %{SCRIPT_URI}/grafik/$2 [R]
RewriteRule ^(.*)/js/(.+)$ %{SCRIPT_URI}/js/$2 [R]
RewriteRule ^(.*)/uni_portfolio/(.+)$ %{SCRIPT_URI}/uni_portfolio/$2 [R]
RewriteRule ^(.*)/dokument/(.+)$ %{SCRIPT_URI}/dokument/$2 [R]

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>

1 个回复
最合适的回答,由SO网友:user42826 整理而成

我认为你的WP中缺少了一些规则。htaccess文件。我在下面展示我的。请注意wp admin的规则,将其添加到您的文件中:

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /subcataloged/cliens-wp/
RewriteRule ^index\\.php$ - [L]

# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\\.php)$ $2 [L]
RewriteRule . index.php [L]
</IfModule>
# END WordPress

结束

相关推荐

GoPardy托管wp-admin问题

我在GoDaddy托管帐户(Windows)上的/wp admin登录页有一个大问题。如果访问以下url,我将无法登录。我再次被引导到登录页面。域。com/wp admin如果使用以下URL,我可以登录。域。com/wp admin/(末尾带正斜杠)域。com/admin域。com/login我将要使用的域指向wordpress的安装,它位于根目录的子目录下。禁用permalinks(删除了web.config,我想是windows的.htaccess)禁用的插件在数据库中验证了站点URL(它不包含额外的