htaccess

I’m having a moment of brain lock. I’ve done this before without issue
but I’m choking on it in a big way this time.

I’ve removed the php file extension and forced a trailing slash to
change this:

somesite.com/my_page.php

to

somesite.com/my_page/

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/]+)/$ $1.php

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

That part works.

The pages are being found but the reference to the stylesheet is
broken, they’re rendering with no styling. The only exception is the
homepage which is fine. What am I missing?

Btw, all relative links use “my_page” instead of “my_page.php”.

T.


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

If you don’t see the stylesheets, the first place to look is the base
HREF. Most likely, Apache is trying to construct that path based on
the assumption that your tail-less filename is really a folder. If you
script your page to automatically write a base href tag based on the
real folder that file is found in, you should be all set.

Walter

On Jul 12, 2010, at 1:23 PM, Todd wrote:

I’m having a moment of brain lock. I’ve done this before without
issue but I’m choking on it in a big way this time.

I’ve removed the php file extension and forced a trailing slash to
change this:

somesite.com/my_page.php

to

somesite.com/my_page/

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^([^/]+)/$ $1.php

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

That part works.

The pages are being found but the reference to the stylesheet is
broken, they’re rendering with no styling. The only exception is the
homepage which is fine. What am I missing?

Btw, all relative links use “my_page” instead of “my_page.php”.

T.


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


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

Can the base href be added to the htaccess file? Btw, this is a static
site that uses includes and all the files live in the site root, no
sub-directories if that matters.

T.

On Jul 12, 2010, at 12:29 PM, Walter Lee Davis wrote:

If you don’t see the stylesheets, the first place to look is the
base HREF. Most likely, Apache is trying to construct that path
based on the assumption that your tail-less filename is really a
folder. If you script your page to automatically write a base href
tag based on the real folder that file is found in, you should be
all set.


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

What is in the includes, and what part of the site is static?

I don’t know exactly how you can set the base href in an htaccess, but
that’s such a wild plug-in that I imagine almost anything is possible.
Take a look at setting Apache Environment variables using htaccess and
see if you can find the right one to modify and the syntax to do so.

Important question – do all the URLs appear to have a common root, or
do you ever cause virtual paths to appear in the site? Do the URLs in
the site all look like http://example.com/page1, http://example.com/page2
, http://example.com/page3; or do you ever do http://example.com/variable1/variable2/page4?

Walter

On Jul 12, 2010, at 1:36 PM, Todd wrote:

Can the base href be added to the htaccess file? Btw, this is a
static site that uses includes and all the files live in the site
root, no sub-directories if that matters.


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

They all appear to have a common root.

I found one possible solution and that’s to add …/ to all script and
stylesheet paths. Not sure if this is the most elegant or efficient
approach but it works.

I’ll have to look in the Apache docs for other options.

T.

On Jul 12, 2010, at 1:11 PM, Walter Lee Davis wrote:

What is in the includes, and what part of the site is static?

I don’t know exactly how you can set the base href in an htaccess,
but that’s such a wild plug-in that I imagine almost anything is
possible. Take a look at setting Apache Environment variables using
htaccess and see if you can find the right one to modify and the
syntax to do so.

Important question – do all the URLs appear to have a common root,
or do you ever cause virtual paths to appear in the site? Do the
URLs in the site all look like http://example.com/page1, http://example.com/page2
, http://example.com/page3; or do you ever do http://example.com/variable1/variable2/page4?

Walter

On Jul 12, 2010, at 1:36 PM, Todd wrote:

Can the base href be added to the htaccess file? Btw, this is a
static site that uses includes and all the files live in the site
root, no sub-directories if that matters.


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