Tell me more ×
WordPress Answers is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I installed WP in subfolder /cms and it runs live without subfolder. When I use /%postname%/ as permalink I get 404 error on my site. My Server supported mod_rewrite.

My Code

wp-config.php

define('WP_SITEURL', 'http://www.sitename.de/cms');
define('WP_HOME', 'http://www.sitename.de');

root

1) .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /cms/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /cms/index.php [L]
</IfModule>

2) index.php

<?php
define('WP_USE_THEMES', true);
require('./cms/wp-blog-header.php');
?>  

/cms

1) .htaccess

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

2) index.php

<?php
define('WP_USE_THEMES', true);
require('./wp-blog-header.php');
?>  

Thanks for your help
Ogni

share|improve this question

1 Answer

Get rid of the .htaccess file under /cms and then visit Settings -> Permalinks to flush your rewrite rules. Also make sure the site URL and home URL are set up in the database correctly (like you have in the wp-config).

share|improve this answer
if you define site and home url in wp-config, whatever is in the database will be ignored – Milo Oct 6 '12 at 15:27
@Milo: Thats right When I refresh my permalinks (wp admin-area), root .htaccess looks like: .. RewriteBase / ... RewriteRule . /index.php [L] but I think it should looks like: ... RewriteBase /cms ... RewriteRule . /cms/index.php [L] – ogni Oct 6 '12 at 18:40
in the root, i think it should look like RewriteBase / as it apparently does after refreshing permalinks. Did that solve it ? – pike Feb 8 at 17:04

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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