|
Home > Archive > Apache Server configuration support > January 2007 > [mod_rewrite] www.server.com/XX --> www.server.com/item.php?id=XX
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
[mod_rewrite] www.server.com/XX --> www.server.com/item.php?id=XX
|
|
|
| Hello:
RewriteEngine On
RewriteRule ^([a-z0-9_-]+)?$ where.php [L]
This is my simple .htaccess. It sends to where.php, which then takes visitor
to the proper place. The reason is that I have index.php file and ok/
directory in the main folder, so addresses www.server.com/index.php
www.server.com/ and www.serwer.com/ok should not be changed but everything
else that starts from www.server.com should go to
www.server.com/item.php?id= and the where.php is the script that shooses
where to send the user.
How can I do it without where.php script?
Regards,
Talthen
| |
|
| talthen.z-serwera.o2@nospam.pl wrote:
> Hello:
>
> RewriteEngine On
> RewriteRule ^([a-z0-9_-]+)?$ where.php [L]
>
> This is my simple .htaccess. It sends to where.php, which then takes
> visitor to the proper place. The reason is that I have index.php file
> and ok/ directory in the main folder, so addresses
> www.server.com/index.php www.server.com/ and www.serwer.com/ok should
> not be changed but everything else that starts from www.server.com
> should go to www.server.com/item.php?id= and the where.php is the
> script that shooses where to send the user.
> How can I do it without where.php script?
I usually solve this by inspecting wether a file exists:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?id=$1 {L,QSA]
--
Rik Wasmus
| |
|
| "Rik" <luiheidsgoeroe@hotmail.com> wrote:
> I usually solve this by inspecting wether a file exists:
>
> RewriteEngine On
> RewriteCond %{REQUEST_FILENAME} !-f
> RewriteCond %{REQUEST_FILENAME} !-d
> RewriteRule ^(.+)$ index.php?id=$1 {L,QSA]
I changed
RewriteRule ^(.+)$ index.php?id=$1 {L,QSA]
to
RewriteRule ^(.+)$ index.php?id=$1 [L,QSA]
and works great. Thank you!
Regards,
Talthen
|
|
|
|
|