I have the following code that rewrites the URL you entered to correctly identify the areas, sub-areas, and content ID that the visitor is trying to access:
# Rewrite the url
<IfModule mod_rewrite.c>
RewriteEngine On
# Redirect when we have a single parameter
RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?mod=$1
RewriteRule ^([a-zA-Z0-9_-]+)/$ index.php?mod=$1
# Redirect when we have two parameters
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?mod=$1&call=$2
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/$ index.php?mod=$1&call=$2
# Redirect when we have three parameters
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+)$ index.php?mod=$1&call=$2&id=$3
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)/([0-9]+)/$ index.php?mod=$1&call=$2&id=$3
</IfModule>
Problem
In the domain there are sub domains that are no longer accessible if the .htaccess
in the root contains the code above.
Structure
public_html // root http://www.meuSite.com/
public_html/cdn // sub-domínio http://cdn.meuSite.com/
public_html/app // sub-domínio http://app.meuSite.com/
Question
How to use URL rewriting for the parent folder, but still allow direct access to folders in the root (sub domains )?