What are your <VirtualHost>s like? What are the sub domain document roots like?
Also try
- Code: Select all
RewriteEngine On
RewriteRule !(\.[^/]+|[^/])$ %{REQUEST_URI}.php [PT,L]
RewriteEngine On
RewriteRule !(\.[^/]+|[^/])$ %{REQUEST_URI}.php [PT,L]
^([^\?]*)index\.php(\?.*)?$
#
# Get rid of '.php':
#
RewriteCond %{THE_REQUEST} \ /[^\?]+\.php(\?.*)?\ [NC]
RewriteRule ^(/.+)\.php$ $1 [NC,R=301,L]
#
# Rewrite extensionless URLs to ".php" page
#
RewriteRule !(\..+|/)$ %{REQUEST_URI}.php [L]
#
# Get rid of 'index' in directories:
#
RewriteCond %{THE_REQUEST} \ /[^\?]+index(\.php)?(\?.*)?\ [NC]
RewriteRule ^(/(.+/)?)index(\.php)?$ $1 [NC,R=301,L]
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{THE_REQUEST} \ [^/\?]+//[^/\?]+/([^\?]+/)?index(\..+|\?.*)?\ [NC]
RewriteRule . /%1 [R=301,L]
# Remove the .php from PHP files (only files
# that exist).
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_FILENAME} -f
RewriteRule ^(/.+)\.php$ $1/ [R=301,L]
# Rewrite /<name and /<name>/ to /<name>.php if
# a PHP file exists and a directory does not.
RewriteCond %{DOCUMENT_ROOT}$1.php -f
RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_FILENAME} !-d
RewriteRule ^(/.*[^/])/?$ $1.php [QSA,L]
AbuAaminah wrote:The good news is that the following works in its entirety:
- Code: Select all
#
# Remove the inex.php
#
RewriteCond %{THE_REQUEST} index
RewriteCond %{THE_REQUEST} !\?.*\index
RewriteRule ^([^\?]*)index\.php(\?.*)?$ $1$2 [R=301,L]
# Remove the .php from PHP files (only files that exist).
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{SCRIPT_FILENAME} -f
RewriteRule ^(.+)\.php$ /$1/ [R=301,L]
# Redirect /<name to /<name>/ if a PHP file or directory exists.
RewriteCond %{DOCUMENT_ROOT}/$1.php -f [OR]
RewriteCond %{SCRIPT_FILENAME} -d
RewriteRule ^(.*[^/])$ /$1/ [R=301,L]
# Rewrite /<name and /<name>/ to /<name>.php if a PHP file exists and a directory does not.
RewriteCond %{DOCUMENT_ROOT}/$1.php -f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule ^(.*[^/])/?$ /$1.php [QSA,L]
Your one-line index removal doesn't work at all, but the one above does.
I'm now trying this in the httpd.conf file and will report back ASAP.
RewriteCond %{THE_REQUEST} \ [^/\?]+//[^/\?]+/([^\?]+/)?index(\..+|\?.*)?\ [NC]
RewriteRule . /%1 [R=301,L]
AbuAaminah wrote:Okay. Mixed results when placed in conf file...
1. /directory/file => //directory/file/ (5 sec delay and additional slash added before /directory)
2. /directory/file.php => /directory/file.php
3. /directory/directory => /directory/directory/
4. /directory/index.php => /directory/
5. /directory/index => //directory/index/ (5 sec delay and additional slash added before /directory)
(Note: This is my desktop, localhost, in which 5 sec delays are taking place)
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{THE_REQUEST} \ /([^\?]+/)?index(\..+|\?.*)?\ [NC]
RewriteRule . /%1 [R=301,L]
# Remove the .php from PHP files (only files
# that exist).
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_FILENAME} -f
RewriteRule ^(/.+)\.php$ $1/ [R=301,L]
# Redirect /<name to /<name>/ if a PHP file
# or directory exists.
RewriteCond %{DOCUMENT_ROOT}$1.php -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_FILENAME} -d
RewriteRule ^(/.*[^/])$ $1/ [R=301,L]
# Rewrite /<name and /<name>/ to /<name>.php if
# a PHP file exists and a directory does not.
RewriteCond %{DOCUMENT_ROOT}$1.php -f
RewriteCond %{DOCUMENT_ROOT}%{SCRIPT_FILENAME} !-d
RewriteRule ^(/.*[^/])/$ $1.php [QSA,L]
Users browsing this forum: No registered users and 4 guests