Angular 7.htaccess用于子域



由于某种原因,标准.htaccess在标准的www.domain.com url上工作,但对于子域app.domain.com,无论是什么.htacccess配置,刷新页面时我都会得到404。有什么想法吗?当前文件:

<IfModule mod_rewrite.c>
RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
# If the requested resource doesn't exist, use index.html
RewriteRule ^ /index.html
</IfModule>

Apache Conf:

<VirtualHost *:80>
ServerAdmin user@gmail.com
ServerName app.domain.com
ServerAlias app.domain.com
DocumentRoot /var/www/app.domain.com/html
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
<Directory "/var/www/app.domain.com/html">
AllowOverride All
</Directory>

子域文件夹中的我的htaccess文件

.htaccess

RewriteEngine On
# If an existing asset or directory is requested go to it as it is
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR]
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d
RewriteRule ^ - [L]
# If the requested resource doesn't exist, use index.html
RewriteRule ^ /subfolder-name/index.html

index.html

<base href="/subfolder-name/">

希望这能帮助

最新更新