This .htaccess is working only for http://localhost/ but I want http://localhost/portal:
RewriteEngine on
RewriteCond %{REQUEST_URI} !portal/public/
RewriteRule (.*) /portal/public/$1 [L]
url in browser is http://localhost/ , http://localhost/login and so on, when I changed it to:
RewriteEngine on
RewriteCond %{REQUEST_URI} !portal/public
RewriteRule /portal(.*) /portal/public/$1 [L]
url in browser is redirecting to http://localhost/portal/public/index.php instead of displaying http://localhost/portal/
答案 0 :(得分:0)
如果您使用laravel,为什么不使用它的功能呢?
您可以通过Route Group Prefixes
Route::prefix('portal')->group(function () {
Route::get('users', function () {
// Matches The "/portal/users" URL
});
});