3

I have WordPress 3.3.1 installed in a sub directory on my site just to use as a staging test site. It seems the root sites .htaccess is creating problems for Wordpress wp-admin page. I've set the WordPress Address (URL) and Site Address (URL) to point correctly to the sub directory url.

If I haven't got any .htaccess inside my subdirectory (wp root) = wp admin (login page) works.

If I add a .htaccess like below, the page works and if you are logged in to wp-admin it sort of works BUT every time you try to save something = blank page, if you aren't logged in and try to login = blank page.

# 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

Summary:

[.htaccess in wp root (www.domain.com/sub/cat/)] == Site (except wp-admin) works as expected.

[No htaccess] == Site CSS, images, js is rewritten incorrectly to the root folders, Wp-admin works fine.

How can I solve this? Is there a .htaccess for WP 3.3.1 I can use?

This is my .htaccess for my OTHER WEB ROOT site (not 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>
2
  • Stupid question, but is "clients" mis-spelled as "cliens" in RewriteBase /subcataloged/cliens-wp/?
    – Bendoh
    Dec 3, 2013 at 16:17
  • No it's the company name :p
    – OZZIE
    Dec 4, 2013 at 14:08

1 Answer 1

3
+50

I think you are missing some rules in your WP .htaccess file. I show mine below. Notice the rules for wp-admin, add them to your file:

# 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
1
  • Are you sure you updated the RewriteBase above to match your directory? My htaccess file is almost exactly as your, but adds rules for wp-admin and other directories/files. Here is another way to see the proper rules, remove the WP .htaccess file, then look go to the Network console - mysite.domain.com/subcataloged/cliens-wp/wp-admin/network/…
    – user42826
    Dec 5, 2013 at 15:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.