Page is a not externally linkable
- Code, Content, and Presentation
-- Apache Web Server
---- Issues running CMS in subfolder


Patrick_Taylor - 9:10 pm on Jan 28, 2013 (gmt 0)


To recap:

The website address is either of:
example.com/
example.com/laplume/

The actual content is at either of:
example.com/cms/
example.com/laplume/cms/

The .htaccess exists at either of:
example.com/
example.com/laplume/

The actual content files:
(1) example.com/cms/index.php
(2) example.com/cms/pages.php
(3) example.com/laplume/cms/index.php
(4) example.com/laplume/cms/pages.php

The corresponding requests:
(1) example.com/
(2) example.com/pages
(3) example.com/laplume/
(4) example.com/laplume/pages

The redirects:
example.com/index -> example.com/ (not to be treated as normal 'pages')
example.com/cms/ -> example.com/
example.com/cms/pages.php -> example.com/pages
example.com/laplume/index -> example.com/laplume/ (not to be treated as normal 'pages')
example.com/laplume/cms/ -> example.com/laplume/
example.com/laplume/cms/pages.php -> example.com/laplume/pages

The rewrites:
example.com/ -> example.com/cms/index.php
example.com/pages -> example.com/cms/pages.php
example.com/laplume/ -> example.com/laplume/cms/index.php
example.com/laplume/pages -> example.com/laplume/cms/pages.php

The admin folder must stay unaffected and is either of:
example.com/cms/admin/
example.com/laplume/cms/admin/

-----------------------------------------------------------

The current .htacess file is:

AddDefaultCharset UTF-8

Options +FollowSymLinks
RewriteEngine on

ErrorDocument 404 /error404.php

RewriteCond %{REQUEST_URI} ^/laplume/cms/inc/menu\.php$ [OR]
RewriteCond %{REQUEST_URI} ^/laplume/cms/admin/list\.php$ [OR]
RewriteCond %{REQUEST_URI} ^/laplume/cms/([A-Za-z0-9_-]+)\.txt$ [OR]
RewriteCond %{REQUEST_URI} ^/laplume/cms/comments/([A-Za-z0-9_-]+)\.txt$ [OR]
RewriteCond %{REQUEST_URI} ^/laplume/img/$ [OR]
RewriteCond %{REQUEST_URI} ^/cms/inc/menu\.php$ [OR]
RewriteCond %{REQUEST_URI} ^/cms/admin/list\.php$ [OR]
RewriteCond %{REQUEST_URI} ^/cms/([A-Za-z0-9_-]+)\.txt$ [OR]
RewriteCond %{REQUEST_URI} ^/cms/comments/([A-Za-z0-9_-]+)\.txt$ [OR]
RewriteCond %{REQUEST_URI} ^/img/$
RewriteRule .* - [F]

RewriteCond %{REQUEST_URI} ^/laplume/$
RewriteRule ^$ /laplume/cms/index.php [L]

RewriteCond %{REQUEST_URI} !^/laplume/index$
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /laplume/([A-Za-z0-9_-]+)\ HTTP/
RewriteRule ^([A-Za-z0-9_-]+)$ /laplume/cms/$1.php [L]

RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^$ /cms/index.php [L]

RewriteCond %{REQUEST_URI} !^/index$
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([A-Za-z0-9_-]+)\ HTTP/
RewriteRule ^([A-Za-z0-9_-]+)$ /cms/$1.php [L]


The websites at example.com/ and example.com/laplume/ function correctly but there is the issue of duplicate content.

These display identical content:
example.com/ [canonical]
example.com/cms/
example.com/cms/index.php

These display identical content:
example.com/laplume/ [canonical]
example.com/laplume/cms/
example.com/laplume/cms/index.php

These display identical content:
example.com/pages [canonical]
example.com/cms/pages.php

These display identical content:
example.com/laplume/pages [canonical]
example.com/laplume/cms/pages.php

I'm not actually sure whether some of the rules that are redirects should be rewrites (and vice versa).


Thread source:: http://www.webmasterworld.com/apache/4533901.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com