Welcome to WebmasterWorld Guest from 22.214.171.124 , register , free tools , login , search , subscribe , help , library , announcements , recent posts , open posts Subscribe to WebmasterWorld
Url rewriting question globay msg:1517433 10:05 am on Mar 16, 2003 (gmt 0) Currently I use URL rewriting on my website, but for each main directory, I have an entry in the .htaccess file, and a file without extension:
<Files Red> ForceType application/x-httpd-php </Files> ...
Now is it possible to reduce the structure to just one file, that can read Red, Green, ... as parameters?
Birdman msg:1517434 9:45 pm on Mar 16, 2003 (gmt 0)
Try Apache [ httpd.apache.org] mod_rewrite [ httpd.apache.org]
RewriteRule ^(.*)$ /index.php?color=$1 [L]
That should do it.
Birdman msg:1517435 10:01 pm on Mar 16, 2003 (gmt 0)
I may have misunderstood. If the folders "red" and "green" actually exist, just have a page named index.php in each folder and the url will resolve.
If you want to have one dynamic processing page in your root folder that will handle the parameters, use the method from msg#2. you will have to change the url in the rewrite to your script.
RewriteRule ^(.*)$ /dynamic_script.php?color=$1 [L]
Now you can call the variable $color to determine what to show on the page.
globay msg:1517436 10:21 pm on Mar 16, 2003 (gmt 0)
Thank you birdman for your reply! I think what you wrote will help me. Unfortunately I am not able to implement the code right now, but I will let you know if it works. Just to make sure you understood me correctly, I will tell you again what I need in a less complicated way. Basically I want any Url to be directed to one file.
should open the following file: mydomain.com/database.php
-- .htaccess --
RewriteEngine On RewriteRule ^(.*)$ /database.php [L] ---------------