Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my website I'm trying to implement friendly URLs. I have an index.php file and a .htaccess file in my hosting's public folder. I'm using the following code in the .htaccess file:

DirectoryIndex index.php
RewriteEngine On
RewriteRule ^article/([0-9]+)/$ ../Feed/Article.php?id=$1

Therefore, if anyone enters, it loads the Article.php passing the 15 value through GET.

But the problem is that the Article.php file is outside the public folder (hence the ../) and Apache doesn't find it.

Can anyone help me?

Note: I don't have access to the httpd.conf file.

share|improve this question
up vote 3 down vote accepted

That doesn't rewrite to a filesystem path but a URI. so if Article.php is at your rewrite rule would look like:

RewriteRule ^article/([0-9]+)/$$1
share|improve this answer
Probably better off stripping the out of that rewrite. – Ladadadada Mar 15 '12 at 23:56
Oh, ok I understand. But that forces me to save all the files inside the public folder, right? Isn't it that very insecure? – federicot Mar 16 '12 at 2:45
You can put it in another subdirectory and forbid access to it. But I don't see why it should be a security issue if users can access the script directly? – Marian Mar 16 '12 at 17:01

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.