Note that there are some explanatory texts on larger screens.

plurals
  1. POMatch "full stop" in mod rewrite
    text
    copied!<p>At the moment I am just matching numbers, letters, dashes and underscores in my .htaccess file:</p> <pre><code>RewriteRule ^([A-Za-z0-9-_]+)/?$ index.php?folder=$1 </code></pre> <p>I also want to match full stops in the string. I don't want to use:</p> <pre><code>(.*) </code></pre> <p>I have tried:</p> <pre><code>([.A-Za-z0-9-_]+) ([\.A-Za-z0-9-_]+) ([\\.A-Za-z0-9-_]+) ([A-Za-z0-9-_\.]+) </code></pre> <p>None of which seem to work.... how can I escape the full stop so it matches a full stop!</p> <p>---------- Additional information ----------------</p> <p>As an example:</p> <p>mydomain.com/groups/green/ should go to index.php?folder=green</p> <p>In addition I am also re-writing subdomains over the top of this (I think this is causing the complication)...</p> <p>anotherdomain.com should map to index.php?folder=anotherdomain.com</p> <p>I have succesfully re-written the subdomain with the following rule:</p> <pre><code># external group domain name RewriteCond %{ENV:Rewrite-Done} !^Yes$ ## exclude requests from myhost.com RewriteCond %{HTTP_HOST} !^www\.myhost\.com ## allowed list of domain masking domains RewriteCond %{HTTP_HOST} ^(anotherdomain.com|extra.domain.com|external.otherdomain.com) RewriteRule (.*) /groups/%1/$1 </code></pre> <p>I think this is where the complication lies.</p> <p>---------------- Solution ----------------------</p> <p>Despite not finding a solution to the exact problem above, I have worked around it by changing the first re-direct (which maps the external domains) from:</p> <pre><code> RewriteRule (.*) /groups/%1/$1 </code></pre> <p>to:</p> <pre><code>RewriteRule (.*) /groups/external/$1&amp;external_domain=%1 </code></pre> <p>The second re-write (on the folder) can then interpret the "external domain" variable instead of the folder.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload