Answer the question
In order to leave comments, you need to log in
How to make RewriteRule one for the main page in apache, another for all other pages?
Good day!
Tell me, please, what am I doing wrong?
At the moment, the following rule is set for all pages of the site:
RewriteCond %{HTTP_ACCEPT} text/html [NC]
RewriteCond %{HTTP_HOST} ^mysqite\.com [NC]
RewriteRule .* path/to/html/my.html [L]
RewriteCond %{HTTP_ACCEPT} text/html [NC]
RewriteCond %{HTTP_HOST} ^mysqite\.com$ [NC]
RewriteRule ^$ path/to/html/my-main.html [L]
RewriteCond %{HTTP_ACCEPT} text/html [NC]
RewriteCond %{HTTP_HOST} ^mysqite\.com [NC]
RewriteRule ^/(.*) path/to/html/my.html [L]
Answer the question
In order to leave comments, you need to log in
RewriteRule ^/
/
In VirtualHost context, The Pattern will initially be matched against the part of the URL after the hostname and port, and before the query string (eg "/app1/index.html"). This is the (%-decoded) URL path.
In per-directory context (Directory and .htaccess), the Pattern is matched against only a partial path, for example a request of "/app1/index.html" may result in comparison against "app1/index.html" or "index .html" depending on where the RewriteRule is defined.
Udalos will do it like this:
RewriteCond %{HTTP_ACCEPT} text/html [NC]
RewriteCond %{HTTP_HOST} ^mysqite\.com$ [NC]
RewriteRule ^$ path/to/html/my-main.html [L]
RewriteCond %{HTTP_ACCEPT} text/html [NC]
RewriteCond %{HTTP_HOST} ^mysqite\.com [NC]
RewriteRule !^/path/to/html/my-main$ path/to/html/my.html [L]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question