Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

pretty formed url's starting from the document root

0 views
Skip to first unread message

Rutger Claes

unread,
Jul 10, 2003, 5:27:37 AM7/10/03
to
If read an articla on phpbuilder where they explain how to get your php site
to run with "pretty-url's" in stead of those horrible, searchbot-scaring id
= ... methods.
<quote>
So in Apache's access.conf file, I added the following lines:
<Location /local>
ForceType application/x-httpd-php3
</Location>
This forces everything under the "/local/" directory to call a script
called "local" in the root of my server. "local" then uses PHP to parse the
URL and
act accordingly:
</quote>

But what if I want _all_ of my directories to go this way:

www.foobar.com
www.foobar.com/news
www.foobar.com/files

Should be processed with the same form.

How do I do this?


Rutger Claes

unread,
Jul 10, 2003, 10:22:23 AM7/10/03
to
> This isn't a task for PHP (or shouldn't be anwyay) but rather down to
> Apache's RewriteEngine.
>
> You can do the likes of:
>
>
> RewriteEngine on
> RewriteRule ^/news/(.*)$ /news.php?id=$1 [L]
> RewriteRule ^/files/(.*) /files.php?id=$1 [L]
>
>
> This would then use URLs such as:
>
>
> http://www.foobar.com/news/1
> http://www.foobar.com/files/103543

I would like to do it as explained in this article:
http://www.phpbuilder.com/columns/tim19990117.php3
To me, it's easier. The only problem is that in this article he uses a
/local directory so that when you enter
www.foobar.com/local/news/02 a script named local in your document root is
executed with a php processor. I'd like to go one step further: having the
same script executed whenever a connection is made. The problem is that


where he says:
<Location /local>
ForceType application/x-httpd-php3
</Location>

I should place:
<Location />
ForceType application/x-httpd-php3
</Location>

And that way a script named "" will be searched for right? Now it's quite
impossible to do this.
So how do I solve this? And I don't like using to much apache-specific
features because I don't run my own webserver and have to do everything
using the .htaccess files provided by my ISP

Rutger


0 new messages