htaccess

I’m removing the file extension and adding a trailing slash using:

#Remove File Extension
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/]+)/$ $1.php
RewriteRule ^([^/]+)/([^/]+)/$ /$1/$2.php

#Add Trailing Slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

So far, so good.

Links are formatted as follows:

For files in the root directory,

href=“/file”

For sub-directories,

href=“/subdirectory/”

So far it all works as expected.

Where it gets hinky is linking 2 files to one another within a sub-directory,

folder
file1.php
file2.php

File1 links to File 2 and vice-versa. If I use the link scheme shown above it throws an error. In other words, in File1, if my link to File2 is,

/file2

I get an error, but if I use the file extension,

/file2.php

it works.

I don’t see why the htaccess isn’t working with regard to these two files in this folder.

Todd
http://xiiro.com


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

One correction:

the path from File 1 to File 2 should be:

/folder/file2

not

/file2

Todd

Where it gets hinky is linking 2 files to one another within a sub-directory,

folder
file1.php
file2.php

File1 links to File 2 and vice-versa. If I use the link scheme shown above it throws an error. In other words, in File1, if my link to File2 is,

/file2

I get an error, but if I use the file extension,

/file2.php

it works.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

Hi Todd,
I’ve not studied your htaccess rules closely but wouldn’t the link from file1 to file2 be just;
file2

without the file extension or leading slash?
Regards,
Tim.

On 21 Mar 2012, at 19:52, Todd wrote:

One correction:

the path from File 1 to File 2 should be:

/folder/file2

not

/file2

Todd


FreewayActions.com - Freeware and commercial Actions for Freeway Express & Pro - http://www.freewayactions.com
FreewayStyle.com - Free Freeway templates and parts to download, use and explore - http://www.freewaystyle.com


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options

I’ve not studied your htaccess rules closely but wouldn’t the link from file1 to file2 be just;
file2

without the file extension or leading slash?

That’s what I thought too but I’ve already tried that and I still get the “not found on this server” error.


dynamo mailing list
email@hidden
Update your subscriptions at:
http://freewaytalk.net/person/options