1

I have a problem with .htaccess, and I am no big expert.

The file structure here is:

cms cms\sites cms\sites\site

Using godaddy (linux delux multihosting) I have www.example.com pointing to 'cms\sites\site'.

If I were browsing the site as a whole url www.mainhosting.com\cms\sites\site - the linkes would work correctly. However using example.com the links would result in a page not found

cms\sites\cite\cms\sites\site\page.php page not found.

These are the .htaccess files I have:

cms

Options -Multiviews (WHEN I TAKE THIS AWAY THE .php extension doesnt get added but no double URL i.e. cms\sites\site\page page not found)
Options -Indexes
Options +FollowSymLinks

RewriteEngine on 

RewriteCond %{REQUEST_URI} !api\\dispatch\.php$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^api/.* api/dispatch.php [L,QSA]

RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php

cms\sites & cms\sites\site

Options +FollowSymLinks 
Options -Indexes
RewriteEngine On

ErrorDocument 400 /page/error
ErrorDocument 401 /page/error
ErrorDocument 403 /page/error
ErrorDocument 404 /page/error
ErrorDocument 500 /page/error

#ref: http://stackoverflow.com/questions/1698464/mod-rewrite-to-remove-php-but-still-serve-the-php-file
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME}\.php -f 
RewriteRule ^(.*)$ $1.php
malteseKnight
  • 347
  • 4
  • 12
  • I'm curious why all your conditions except for the error document use a backslash instead of the standard forward slash that is the directory separator in linux. (I also don't _believe_ that `.` needs to be escaped, but I may be wrong about that) – Jon May 06 '14 at 17:55
  • What is `RewriteCond %{REQUEST_URI} !api\\dispatch\.php$` shouldn't it be `RewriteCond %{REQUEST_URI} !api/dispatch\.php$` – AbraCadaver May 06 '14 at 18:00
  • These come 'out of the box' with the CMS package I installed. Very limited knowledge of what is going on apart from it being a rewrite of the URL. – malteseKnight May 07 '14 at 13:48

1 Answers1

1

I added Rewritebase / and this seems to have done the trick

malteseKnight
  • 347
  • 4
  • 12