I have a multi-domain setup that looks like this on my server ... this is a structure model:
- .htaccess
- *** my site
- .htaccess
- index.php
- projects.php
- jobs.php
- some-project.php
- other-project.php
- some-job.php
- other-job.php ***
- another domain
- another domain
- another domain
I have two goals:
1.) . The root .htaccess file should only make sure that my main domain, which /my-websitestarts / runs automatically as you type www.my-website.com. Due to the fact that I have a multi-domain ftp server, I need to specify this. This is already working.
2.) In my subdirectory, /my-websiteI need a few different rules, especially regarding the best URL design and the .php extension extension.
- ,
/my-website .php. - "" ,
/jobs /projects, , php .
, @anubhava .
DocumentRoot/.htaccess:
RewriteEngine On
RewriteBase /
RewriteRule ^projects/(.+?\.php)$ /$1 [L,NC]
RewriteRule ^jobs/(.+?\.php)$ /$1 [L,NC]
RewriteRule ^(downloads/.+)/?$ assets/$1 [L,NC]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/$1\.php -f [NC]
RewriteRule ^(.+?)/?$ $1.php [L]
RewriteCond %{REQUEST_URI} !^/my-website/
RewriteCond %{DOCUMENT_ROOT}/my-website%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}/my-website%{REQUEST_URI} -d
RewriteRule ^(.*)$ /my-website/$1 [L]
/my-website/.htaccess:
RewriteEngine On
RewriteBase /my-website/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/my-website/$1\.php -f [NC]
RewriteRule ^(.+?)/?$ $1.php [L]
, my-website .php . , /projects, run/exectute /projects.php -. , 404.
, /projects/some-project / /some-project.php ( projects ), , 404.
, .
- ! , - handeld.
/my-website , .php ""
, ...
- www.my-website.com//
- www.other-domain.com//
- www.my-website.com/projects// .php
- www.my-website.com/projects.php// ( projects.php)
- www.my-website.com/projects/some-project// ( some-project.php)
- www.my-website.com/projects/some-project.php// ( some-project.php)