homepage Welcome to WebmasterWorld Guest from 54.237.99.131
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

    
Extensionless Fake Directories using mod rewrite
"mypage/1/2/3/" instead of "mypage.php/1/2/3/"
cosmoyoda

5+ Year Member



 
Msg#: 3650401 posted 12:57 am on May 15, 2008 (gmt 0)

Hi everyone,

I'm sure you've all seen sites with URLs like: http://www.example.com/some_page.php/category1/page2

I was wondering if it was possible to have it but without the .php extension. I already have functions in my .htaccess file to hide .php extensions. It works perfectly everywhere, except when there is a trailing slash after it. How can I make it work?

Please help, I've tried searching on this forum and googling like mad for several days and I came up with nothing. Thanks again!

[edited by: encyclo at 1:08 am (utc) on May 15, 2008]
[edit reason] switched to example.com [/edit]

 

cosmoyoda

5+ Year Member



 
Msg#: 3650401 posted 4:10 am on May 15, 2008 (gmt 0)

Sorry, I forgot to post my .htaccess code. So far this is what I have:
## Enable mod_rewrite, start rewrite engine
RewriteEngine on
RewriteBase /

## Converts test.php to test
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)/?$ $1.php [L]

Any small changes I need to make to this code to make it work for both www.example.com/mypage.php/1/2/3 and www.example.com/mypage/1/2/3? I appreciate any help, thanks!

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