我的项目结构是
Root
我要重定向
/ -> vujes
/peoples -> vuejs
/contact -> vuejs
/api/user/授权->代码点火器
我的.htaccess代码是
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteRule ^(api)($|/) - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.html [L]
RewriteBase /api
RewriteRule ^$ index.php [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond $1 !^(index\.php|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ /api/index.php?/$1 [L]
</IfModule>Vuejs vue-路由器工作正常,但Codeigniter自由url不工作./ -> vujes (工作)
/peoples -> vuejs (工作)
/contact -> vuejs (工作)
/api/ ->码点火器(工作)
/api/user/ -> vuejs (不工作)
我该怎么补救?
发布于 2020-04-13 05:30:14
我自己找到了我的问题。
/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} ^/?(api)/
RewriteRule ^api/(.*)$ /api/index.php?$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/?(api)/
RewriteRule . /index.html [L]
</IfModule>/api/.htaccess
<IfModule mod_rewrite.c>
SetEnv CI_ENV production
RewriteEngine On
RewriteBase /api
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /api/index.php/$1 [L]
</IfModule>https://stackoverflow.com/questions/61134784
复制相似问题