Page 1 of 1

mod_rewrite question

Posted: Sat Jan 16, 2010 6:57 pm
by GeXus
Hello all,

I have the following rewrite rule setup

Code: Select all

 
RewriteEngine on
RewriteRule ^([^/\.]+)/?$ product.php?product=$1&%{QUERY_STRING} [L]
RewriteCond %{REQUEST_FILENAME} -f [NC,OR]
RewriteCond %{REQUEST_FILENAME} -d [NC]
RewriteRule .* - [L] 
 
Basically, this allows me to do something like http://www.domain.com/productname/?some=1&another=2 and gives me productname as the product variable.

Now, I want to have it so I can maintain this /productname/ url but access other pages, so for example

http://www.domain.com/productname/register.php , where register.php lies on the root domain... Any ideas how I can do this?

Thank you!

Re: mod_rewrite question

Posted: Sun Jan 17, 2010 9:05 am
by josh
You want the Mod_Alias module, not mod_rewrite
http://httpd.apache.org/docs/1.3/mod/mo ... aliasmatch

Re: mod_rewrite question

Posted: Sun Jan 17, 2010 12:03 pm
by GeXus
Hmm.. Looked into this, but not exactly sure... any other tips?

Re: mod_rewrite question

Posted: Sun Jan 17, 2010 3:22 pm
by josh
Not sure what you mean. If you want some scripts to be used outside the web root, the alias directives do that for you. They use the same syntax as regular expressions if you look at my link.

Re: mod_rewrite question

Posted: Sun Jan 17, 2010 8:24 pm
by GeXus
Well I still want it to be in the webroot, so the current modrewrite that I'm using works... but only for product.php that's declared within the htaccess, there are other pages that are in the web root, that I would like to be accessed via a different URL, so for example having /register.php be accessed via the wildcard/register.php