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.
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.
But you did create a second atom with the "(/)?". MINOR point but, IMHO, you could learn from it.
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.
Think: Why would it mess up? You SHOULD quickly come to the obvious answer that it matches ALL your files in that directory. The objective you need to turn to is how to EXCLUDE those files.
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.
Do you consider "assistance" to be "free coding" or "helping you learn?" If you weren't here for a lesson, WHY did you come and ask for assistance?
[aside]If you are asking for "free coding," please let me know. You should know that I don't do coding for "script kiddies" - which I didn't believe you were or I wouldn't bother responding.[/aside]
Did you bother to read the tutorial? IMHO, you NEED to read the regex section then use your training as a programmer to think about the problem logically: Redirect letters, digits and dots to your index.php script ... WITHOUT redirecting other files. Hmmm, there is a RewriteCond code which addresses whether the {REQUEST_URI} is a file or not. If you have read my signature's tutorial, you'd know the format of that mod_rewrite statement and how to prepend it to your RewriteRule.
BTW, I mean no offense by being pedantic. My purpose of spending my time here in this forum is to help others LEARN.
Yes, another lesson but I hope that you can learn from it and, ultimately, help others learn, too.
Armin
Bookmarks