Forum Moderators: phranque
i have always been able to successfully rewrite urls for files and for directories but seperately, never been able to do the both at same time.
leme explain
www.domain.com/index.php?id=10
rewritting it is simple
www.domain.com/directory1/
rewritting this is simple again
but
rewritting both of them in the same .htaccess, how to do that
www.domain.com/directory1/index.php?id=10
www.domain.com/index.php?id=10
i am not a newbie, but am unable to get them to work together.
Any Assistance?
Thank you
Kami
i have an index.php file in public_html folder.
that takes parameter like this
index.php?page=blahblah
now if someone types in
mydomain.com/test-page.html
i get index.php?page=test-page.html
exactly as what i want
but if someone types in
mydomain.com/directory1/test-page.html
to handle this i have no htaccess code, i want this request to be sent to my index.php like this
mydomain.com/index.php?directory=directory1&page=test-page.html
Thanks
RewriteRule ^([^/]+)/(.*\.html)$ /index.php?directory=$1&page=$2 [L]
Depending on how the previous rule was setup up, this may have to go before it. (If it's different, then the order doesn't matter.)