.htaccess domain name folder

Hey guys,

This line is causing a lot of issues:

RewriteRule ^([_A-Za-z0-9\.-]+)(/)?$ index.php?strURL=$1

I basically want it so that when someone goes to domain.com/domain.com , it points to domain.com/index.php?strURL=domain.com and opens the page passing “domain.com” as a param of index.php

Any clues?

Thanks in advance,


RewriteRule ^([_A-Za-z0-9\\.-]+)(/)?$ index.php?strURL=$1

That mod_rewrite says to start with one or more letter, digit, dot character (which is NOT supposed to be escaped in a character range definition), underscore or hyphen, followed with a trailing slash (or not) before the end of the string and redirect to index.php with the query string strURL={the first atom} (WHY make an atom of the trailing /?). Of course, this SHOULD loop as the regex also matches index.php as well as any other filename you may have in that directory.

I’ve NO clue what you’re trying to do. However, it’s evident that you need a little bit of a tutorial in mod_rewrite so I invite you to have a read through the appropriate parts (i.e., AT LEAST Regex and the Examples) of the tutorial linked in my signature. You know where to find me to ask when you have questions.



I’m trying to write a mod rewrite to point example.com/domain.com => example.com/index.php?strURL=domain.com

So people can type example.com/yahoo.com and it would load index.php passing yahoo.com into the get parameter.

WHY make an atom of the trailing /?

I’m not. I’m an atom for the FIRST group being ([_A-Za-z0-9\.-]+). I guess the “?” does not need brackets around it, but it doesnt make a difference in this case.

Rules I’ve written like this one:
RewriteRule ^([_A-Za-z0-9-]+)(/)?$ game.php?strPage=$1

work just fine, but as soon as I want “.” to be included, it messes up.

Now, thanks for your reply, but I did not need to hear a lesson, I needed help on finding a solution. I’m a Software Engineer with over 10 programming languages and 4 human languages in my head. I’d appreciate some assistance here.