homepage Welcome to WebmasterWorld Guest from 50.19.172.0
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / Apache Web Server
Forum Library, Charter, Moderators: Ocean10000 & incrediBILL & phranque

Apache Web Server Forum

    
Filenames same as folder names
Server redirects to folder
Patrick Taylor

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3877503 posted 9:25 am on Mar 24, 2009 (gmt 0)

I have a website with URLs like:

http://www.example.com/mything
http://www.example.com/mything/myotherthing

Until last December everything was fine, but since then, when the service provider upgraded cpanel, the server rewrites:

http://www.example.com/mything
to:
http://www.example.com/mything/ (with a trailing slash)

To allow extentionless URLs, my .htaccess file contains:

# Rewrite "string" everything to 'with-suffix'
RewriteRule ^([a-z0-9\-]+)$ /$1.php [L]
#
# Rewrite "string/string" everything to 'with-suffix'
RewriteRule ^([a-z0-9\-]+)/([a-z0-9\-]+)$ /$1/$2.php [L]

The service provider has said that naming a folder (eg: mything) with the same name as a file is bad practice as the cpanel will tend to look at the folder as this takes a higher priority. Is this correct? Everything was fine for a couple of years, but not any more.

 

jdMorgan

WebmasterWorld Senior Member jdmorgan us a WebmasterWorld Top Contributor of All Time 10+ Year Member



 
Msg#: 3877503 posted 1:08 pm on Mar 24, 2009 (gmt 0)

If you're on Apache 2, see the DirectorySlash directive.

Jim

Patrick Taylor

WebmasterWorld Senior Member 10+ Year Member



 
Msg#: 3877503 posted 6:39 pm on Mar 24, 2009 (gmt 0)

Many thanks. At the top of the .htaccess file is now:

DirectorySlash Off

Back to normal.

Patrick

[edited by: Patrick_Taylor at 6:40 pm (utc) on Mar. 24, 2009]

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Apache Web Server
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved