Welcome to WebmasterWorld Guest from 54.226.25.231

Forum Moderators: Ocean10000 & incrediBILL & phranque

Message Too Old, No Replies

Extensionless Fake Directories using mod rewrite

"mypage/1/2/3/" instead of "mypage.php/1/2/3/"

     

cosmoyoda

12:57 am on May 15, 2008 (gmt 0)

5+ Year Member



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

4:10 am on May 15, 2008 (gmt 0)

5+ Year Member



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!

 

Featured Threads

Hot Threads This Week

Hot Threads This Month