Forum Moderators: phranque

Message Too Old, No Replies

Rewrite Problem

         

Andre83

8:18 am on Jun 14, 2006 (gmt 0)



I'd like to have an url like this:

[mydomain.com...]
and
[mydomain.com...]

but I couldn't find a way to do it.

I was able to do this:
RewriteRule (.*)/ [mydomain.com...]

but this only solves the first part of the problem. How can I do to make the "add" part work too? I've tried something like this, but it doesn't work:

RewriteRule (.*)/(.*) [mydomain.com...]

Any ideas?

jdMorgan

8:09 pm on Jun 14, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Something like:

RewriteRule ^([^/]+)/([^/.]+)/?$ /add.php?u=$1&action=$2 [L]
RewriteRule ^([^/.]+)/?$ /user.php?u=$1 [L]

This code is set up so that no URL with an extension (such as "add.php" or "robots.txt" or "logo.jpg" will be rewritten. I've also modified the syntax so that it generates an internal rewrite, rather than an external redirect.

For more information, see the documents cited in our forum charter [webmasterworld.com] and the tutorials in the Apache forum section of the WebmasterWorld library [webmasterworld.com].

Jim