Forum Moderators: phranque

Message Too Old, No Replies

Help me! enabling .htaccess screws up my pages

images and files on subdirectories wont load

         

anamassanet

6:10 am on Oct 8, 2005 (gmt 0)

10+ Year Member



Hello all! this is my first post here, i hope someone can help me a bit.

i recently moved my blog system (i use b2evolution) to a new server and had to enable ExtraPath info and .htaccess files to remove the .php from my permalink urls...

A blog enter via a "stub file", that is a php script which just contains the Blog ID parameter. So the url of a "stub" for a blog looks like

www.mysite.net/blogs/myblog.php

myblog php is something like this:

$blogid=33;
require('blogs/main.php')

That shows the blog. If I wanted the url for a post, it would be something like:

www.mysite.net/blogs/myblog.php/2005/03/03/postid333.php

My old server could handle extrapath perfectly and showme urls like

www.mysite.net/blogs/myblog/2005/03/03/postid333.php

note there is no ".php" in the stub file name, so it looks like a directory.

This is the .htaccess im using:


# Apache configuration for the blog folder

RewriteEngine On
# enter all the allowed folder names separated by ¦s
RewriteCond %{REQUEST_URI}!^/(admin¦gettext¦htsrv¦images¦img¦media¦skins)(.*)$
RewriteRule (^[^\./]+)$ $1\.php

# enter the same list of folder names here
RewriteCond %{REQUEST_URI}!^/(admin¦gettext¦htsrv¦images¦img¦media¦skins)(.*)$
RewriteRule (^[^\./]+)/(.+)$ $1\.php/$2

# this will select the default blog template to be displayed
# if the URL is just .../blogs/
<IfModule mod_dir.c>
DirectoryIndex index.php index.html
</IfModule>

# this will make register globals off in b2's directory
# just put a '#' sign before these three lines if you don't want that
<IfModule mod_php4.c>
php_flag register_globals off
</IfModule>

# If you're using Apache 2, you may wish to try this for clean URLs:
AcceptPathInfo On

Anyway, this does remove the .php but now all my blogs skins and images are GONE! it just wont load them. If I rename .htaccess to "whatever" it will display skins and images again, but with ugly ".php"s in every url

Can someone give me a hand? please!

jdMorgan

5:07 pm on Oct 8, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



anamassanet,

Welcome to WebmasterWorld!

Both of your rules contain exclusions for "skins" and "images" and so should have no effect on files in those subdirectories. So, the problem is confusing.

What do you get in your server error log when attempting to load skins and/or images?

Jim

anamassanet

11:31 pm on Oct 8, 2005 (gmt 0)

10+ Year Member



Thanks for your answer, Jim.
My httpd/error_log gives me a lot of theses

[Fri Oct 07 16:59:39 2005] [error] [client 200.8.xx.xx] File does not exist: /var/www/vhosts/default/htdocs/var, referer: [myblogsite.net...]

now, i don´t think i have a /var/www/vhosts/default/htdocs/var...

actually, johnsblog is located at:

/var/www/vhosts/myblogsite.net/httpdocs/blogs/johnsblog.php

My apache original installation sets in httpd.conf

root of html documents: /var/www/html

i changed that to /var/www so changes would affect my vhosts folder, which is the one that contains myblogsite.net, and my other sites...

I´ll paste some lines of my httpd.conf so you guys can see if there is something wrong:

LoadModule rewrite_module modules/mod_rewrite.so
# i have this line, but I dont have AddModule lines... is that right?

UseCanonicalName On
DocumentRoot "/var/www"

<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>

<Directory "var/www/vhosts/myblogsite.net">
# I just noticed the / missing before var! I´ll try correcting that and post the results.
AcceptPathInfo On
AllowOverride All
</Directory>

<Directory "/var/www">
Options Indexes FollowSymLinks MultiViews Includes
AllowOverride All
Order allow,deny
Allow from all
</Directory>

thank you for reading this far!
regards, annie