Forum Moderators: phranque

Message Too Old, No Replies

I need to get the url using .htaccess

after the domain name

         

AjiNIMC

12:32 pm on Nov 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hi,

I am not very comfortable with .htaccess, please help.

I need to do this, if someone is accessing a url say

[mydomain.com...] then I need to pass it to /afile.php?URL=test.html

I tried this,
RewriteRule (.*)$ /fileidentifier.html?URL=$1 [QSA,L] but it not working.

Is it possible using .htaccess?

Thanks,
AjiNIMC

jdMorgan

1:46 pm on Nov 16, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your URL example does not match your code, so it's not clear exactly what file, files, or types of file requests you want to rewrite. If, for example, you wish to rewrite *all and only* .html file requests, and your URL example is correct, then you'd use:

# Rewrite /<anything>.html to /afile.php?URL=<anything>.html
RewriteRule ^([^.]+\.html)$ /afile.php?URL=$1 [L]

If you change your requirements slightly, then the code may change a lot. It's all in the details.

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