Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mod rewrite - Directory Structure

Status
Not open for further replies.

MSRez

Programmer
Dec 22, 2004
57
0
0
EU
I am using the following code in my htaccess file which is almost getting the effect I want (which is for directories to be mapped to my PHP script).

Options +FollowSymLinks
RewriteEngine On
RewriteRule (.*)/$ index.php?r=$1

This allows me to have URLs like example.com/dir/ to be mapped to example.com/index.php?r=dir

The problem is that if I don't fully qualify the URL with a trailing slash i.e. example.com/dir I just get a page not found error.

How can I change this behavior so that this works properly? Perhaps example.com/dir could redirect to example.com/dir/ in the same way that Apache would do that by default if dir was actually a dir?

Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top