.htaccess - Match "full stop" in mod rewrite -


I am currently only matching the numbers, letters, dashes and underscores in the .htaccess file:

  RewriteRule ^ ([A-Za-z0-9 -_] +) /? $ Index.php? Folder = $ 1  

I also want to match the whole stop string. I do not want to use it:

  (. *)  

I have tried:

  ([ A-Za-z0-9 -_] +) ([.. A-Za-z0-9 -_] +) ([\\ .a-za-J 0-9 -_] + () -zza -z0-9 -_.] +) None of these work .... How can I avoid the full stop so that it matches with a complete stop Have an account!  

---------- Additional information ----------------

As an example:

mydomain should go to com / groups / green / index.php? Folder = green

In addition, I am overwriting the subdomain at the top (I think this is causing the complexity) ...

index.com to anotherdomain.com Mapping on php? Folder = anotherdomain.com

I've successfully rewritten the subdomain with the following rule:

  # External group domain name rewriting% {ENV: Rewrite-Done}! ^ Yes, remove the requests from $ # # myhost.com RewriteCond% {HTTP_HOST}! ^ Www. Myhost \ .com # # Domain Masking Domain Permission List RewriteCond% {HTTP_HOST} ^ (otherdomain.com | additional.domain.com | external .otherdomain.com) Revery TeRule (. *) / Group /% 1 / $ 1 < / Code> 

I think this is complexity.

----------- ----- Solution ----------------------

Despite not being able to solve the exact problem of the above, I have worked around it by re-directing it (which performs external domain maps):

  Rewrite rules (. *) / Group /% 1 / $ 1  

duplicate (. *) / Group / external / $ 1 and external_domain =% 1

second Re-list (on folder) can then interpret the "external domain" variable instead of the folder.

Your first option is simple and correct. . There is no special meaning inside , so you literally include it without the need for a special escape.

Actually there is a small problem with the second dash in 0-. 9 -_ . If you want a dash inside the square bracket, then you should keep it at the beginning of the character class. Otherwise it would have a special meaning to determine its character limit:

  ([-. A-Za-z0-9 _] +)  

If it It does not work with something else wrong with your rewriting rule. For example, if this is a global rule rather than a counter-directory (no rewrite), the URL will start with a slash / .


Comments