"You can't access this file directly..."

Discuss practical ways rearrange URLs using mod_rewrite.

Postby Guest » Thu May 09, 2002 1:13 pm

Hello, I've encountered a problem with mod_rewrite that really annoys me. I'm administrating a web site where we (among other things...) post articles.

We use the standard LAMP solution, we store the articles in a MySQL database and create the web pages on the fly with PHP. Because of this, the URL:s become inherently ugly. So, to make things a bit more luser friendly, I decided to make "shortcuts" for the different article categories, so that you can type in http://mysite/blackmagic and then be transfered to http://mysite/snafu.php?cat=846983245&f ... &name=Gorg

My rewrite rule looks like this:
Code: Select all
RewriteEngine On
RewriteRule     ^/blackmagic.*       http://%{HTTP_HOST}/snafu.php?cat=846983245&foo=XAH867Sa&name=Gorg

And it worked great, until recently. After doing some minor changes in httpd.conf and restarting httpd, I now get the following message:
"You can't access this file directly..."
I'd suppose this is because Apache is trying to open snafu.php?cat=846983245&foo=XAH867Sa&name=Gorg, in stead of just redirecting me there. But why? I was redirected before, but that just stopped happening. The changes I had done to httpd.conf before this problem occurred were rather small things (I don't remember exactly what, but I think it was adding ServerName and some stuff like that).

Does anyone have an idea what could be wrong?


Postby Brett » Wed May 15, 2002 9:34 pm

Are you using PHP Nuke? I googled your error and all of the links seemed to be related to PHP Nuke. Maybe one of them will help. Nuke or not, I don't think this is a standard Apache error, so the answer probably lies within the PHP code or php.ini.

<font size=-1>[ This Message was edited by: Brett on 2002-05-16 01:36 ]</font>
Posts: 82
Joined: Tue Jul 10, 2001 4:00 pm
Location: yohost.com

Postby Guest » Thu May 16, 2002 9:39 am

Yeah, that seems to be the problem. I made a rewrite rule pointing to a CGI script and that worked. *sulking*

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: No registered users and 1 guest