You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Jennifer Zelazny <jz...@sandboxdev.com> on 2005/08/31 21:54:44 UTC
[users@httpd] mod_rewrite problems
Hello. I have what I thought would be a simple mod_rewrite need, but
a few hours later, I need some help.
I have some URLs that are ugly: http://www.example.com/modules/
content/index.php?id=14 which I would like to change to:
http://www.example.com/help.php. I tried creating a .htaccess file
with:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^/modules/content/index.php\?id=14$ /help.php [L]
</IfModule>
This does not work. I know mod_rewrite is working, as I tested it
with a simple rule: RewriteRule test.html / [L] and that worked fine.
Any thought would be appreciated.
Thanks,
Jen
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] mod_rewrite problems
Posted by Arne Heizmann <Ar...@csr.com>.
> I have some URLs that are ugly: http://www.example.com/modules/
> content/index.php?id=14 which I would like to change to:
> http://www.example.com/help.php. I tried creating a .htaccess file with:
>
> <IfModule mod_rewrite.c>
> RewriteEngine On
> RewriteRule ^/modules/content/index.php\?id=14$ /help.php [L]
> </IfModule>
If you want to allow users to access the page at /help.php while its
real URL is /modules/content/index.php?id=14, then you have it the wrong
way around. You want:
RewriteRule ^/help.php /modules/content/index.php?id=14 [L]
But if this is really what you want, I'm wondering what the point in
having the ".php" would be; I'd just call it /help.
**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
**********************************************************************
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] mod_rewrite problems
Posted by Joshua Slive <js...@gmail.com>.
On 8/31/05, Jennifer Zelazny <jz...@sandboxdev.com> wrote:
> Hello. I have what I thought would be a simple mod_rewrite need, but
> a few hours later, I need some help.
>
> I have some URLs that are ugly: http://www.example.com/modules/
> content/index.php?id=14 which I would like to change to:
> http://www.example.com/help.php. I tried creating a .htaccess file
> with:
>
>
> <IfModule mod_rewrite.c>
> RewriteEngine On
>
> RewriteRule ^/modules/content/index.php\?id=14$ /help.php [L]
>
> </IfModule>
1. Get rid of the <IfModule> stuff. It just hides useful errors.
2. See the note on the query string under
http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewriterule
3. The correct result will look something like
RewriteEngine On
RewriteCond %{QUERY_STRING} ^id=14$
RewriteRule ^/modules/content/index.php /help.php
Joshua.
---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
" from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org