You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Thomas <th...@gmx.net> on 2005/07/29 16:06:08 UTC
[users@httpd] mod_rewrite issue
Hi,
I have my site setup like this:
index.php?object=object&function=function&action=action&morethings .
I want to be able to have a url like this:
http://mysite.com/object/function/action or morethings.
As you can see, I want to map the url directly to my values (.i.e. /object/
to object=$object .)
I have read some documentation on mod_rewrite with .htaccess and come up
with this:
[code]
RewriteEngine on
RewriteRule ^([A-Za-z])$ /$1/ [R]
RewriteRule ^([A-Za-z])/$ index.php?object=$1
[/code]
Now, if I go http://mysite.com/signup/ it does not map it but only displays
a 404. What am I missing?
My document_root for Apache is not served out of the default folders but
from another location. I did not set it up as a virtual location. Does that
matter? It does not seem to even consider the .htaccess.
Thanks
Thomas
[users@httpd] Re: mod_rewrite issue
Posted by Joost de Heer <sa...@xs4all.nl>.
> RewriteEngine on
> RewriteRule ^([A-Za-z])$ /$1/ [R]
> RewriteRule ^([A-Za-z])/$ index.php?object=$1
>
> Now, if I go http://mysite.com/signup/ it does not map it but only
> displays
> a 404. What am I missing?
That you match only one character in the regexp, instead of an arbitrary
number.
What you need is something like
RewriteRule ^([A-Za-z]+)/$ /index.php?object=$1
Joost
---------------------------------------------------------------------
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