Redirecting the root only via .htaccess with other rules

I have a YOURLS installation that redirects the generated addresses to another domain, however the root is not redirected. How can I establish a rule that will work with existing rules to achieve this? Here is the .htaccess file:

# BEGIN ShortURL
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9A-Za-z]+)/?$ yourls-go.php?id=$1 [L]
# END ShortURL

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L]
</IfModule>

I have a basic understanding of these methods, but I don’t know how individual rules affect each other. Thanks in advance for your help.

+3
source share
2 answers

, , + ( ) * ( ).

0

:

# BEGIN ShortURL
RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9A-Za-z]+)/?$ yourls-go.php?id=$1 [L]

RewriteCond %{REQUEST_URI} ^/$
RewriteRule ^([0-9A-Za-z]*)/?$ yourls-go.php?id=$1 [L]
# END ShortURL

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L]
</IfModule>
0

Source: https://habr.com/ru/post/1716521/


All Articles