现在我这样做:
项目文件夹
C:/Codes/mysite.test/htdocsStd
Document根文件夹
C:/Codes/mysite.test/htdocsStd/public
前台vue、vite、quasar...
C:/Codes/mysite.test/htdocsStd/frontend
距离/水疗中心
...
谷歌一段时间后,ChatGpt 教我:
vhosts.conf
<VirtualHost *:80>
ServerAdmin [email protected]
DocumentRoot "C:/Codes/mysite.test/htdocsStd/public"
ServerName mysite.dtstw.com
ErrorLog "logs/mysite.dtstw.com-error.log"
CustomLog "logs/mysite.dtstw.com-access.log" common
<Directory "C:/Codes/mysite.test/htdocsStd">
Options FollowSymLinks ExecCGI
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
项目文件夹(htdocsStd)是 AllowOverride All,所以 .htaccess 应该能够访问 DocumentRoot 之外的文件
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ /../frontend/dist/spa/$1 [L]
我希望:
http://mysite.test/index
=> C:/Codes/mysite.test/htdocsStd/public/index.html
重写为:
=> C:/Codes/mysite.test/htdocsStd/frontend/dist/spa/index.html
但是我得到了错误的请求。 Apache 的错误日志
[Thu May 11 11:25:26.747472 2023] [core:error] [pid 1820:tid 1160] [client 10.0.0.254:62012] AH10244: invalid URI path (/../frontend/dist/spa/index.html)
如何解决这个问题?