0

This should be simple - can't figure out where I'm going wrong:

We have WordPress installed in the following location: http://example.com/gallery/cms and I want the site to be visible at http://example.com/gallery

I have the WordPress Address set to http://example.com/gallery/cms and the Site Address set to http://example.com/gallery

I copied the .htaccess and index.php to the /gallery folder. The .htaccess contains the following code:

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

The index.php contains the following code:

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

The home page loads up fine, but any interior pages kick of a "Not Found" error: http://playstartshere.com/gallery/specs/ yields The requested URL /gallery/specs/ was not found on this server.

Where am I going wrong? I tried changing index.php to:

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

but that broke the site entirely.

EDIT: ANSWER

Apache was indeed incorrectly configured; RewriteEngine was not enabled. However, the .htaccess was also wrong. Correct .htaccess for a configuration like what's above is:

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

Hope that helps someone else.

1 Answers1

0

/gallery/specs/ is matched by this rule:

RewriteRule ^index\.php$ - [L]

which block access

Try /gallery/.htaccess with:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

without / prepending index.php, apache will search in current directory

edit

Once again with different approach:

set all wordpress URLs to http://example.com/gallery put all wordpress files in /gallery/cms

put one .htaccess in /gallery/cms

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]

put second .htaccess in /gallery (without index.php)

RewriteEngine On
RewriteCond %{REQUEST_URI} !/gallery/cms
RewriteRule ^(.*)$ /gallery/cms/$1 [L]
Jacek Kaniuk
  • 5,229
  • 26
  • 28
  • So I replaced the entire .htaccess with the following: `RewriteEngine On` `RewriteCond %{REQUEST_FILENAME} !-f` `RewriteCond %{REQUEST_FILENAME} !-d` `RewriteRule . index.php [L]` No joy - I still get the 404 Not Found error :( – Eric Oliver May 10 '12 at 16:59
  • but where did You put that .htaccess? – Jacek Kaniuk May 10 '12 at 19:10
  • Thanks again for the response! So I did the following: 1) Updated the .htaccess in both /gallery/cms and /gallery to be the code you indicated 2) removed the index.php from /gallery. The result was that it simply showed the directory listing of files inside the /gallery folder. I then put the index.php file back in; same problem as before: the home page shows fine but navigating to any of the interior pages brings up a 404 error. Any other ideas? – Eric Oliver May 10 '12 at 19:53
  • SOA#1, maybe Apache is badly configured: http://stackoverflow.com/questions/6995545/htaccess-rewriteengine-not-allowed-here#answer-6997903 – Jacek Kaniuk May 10 '12 at 20:16