Htaccess question


I’ve got a little php backend I’ve written that takes an argument in the URL, like this:

I would like to have “friendly” URLs and I’m thinking that I want to do this via a .htaccess file. I guess that friendly URLs would be something like this:

I’ve created the .htaccess file and added the following:

RewriteEngine On
RewriteRule /(.*) /index.php?page=$1 [PT,L]

Yet, when I try to go to, I get an error: “The requested URL /about was not found on this server.”

Obviously, the .htaccess file is not catching and modifying the URL like I’m expecting it to. Any advice?


In per-directory configuration files (read: .htaccess) leave off the directory prefix in the pattern.


Given your document root is ~/

And your .htaccess path is thus ~/

then your directory prefix is /

and thus your pattern would be ^about$

for URL

Second example:

Given your document root is ~/

But your .htaccess path is ~/

then your directory prefix is /blog/

and your pattern would still be ^about$

for URL

:cool: [color=#6600CC]Atropos[/color] |

Thanks Atropos7 - that worked exactly as I was wanting.