I've deploy laravel project in Centos, the application its running successfully but i have the problem.
When laravel code redirect()->back();
the return is to page https://mywebsite.com/
my file:
/public/.htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteBase /myproject/
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
my .htaccess
# Server
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/public/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ public/$1 [L,NC]
</IfModule>
# Disable Directory listing
Options -Indexes
my alias directory
Alias /myproject/var/www/html/litprof/myproject/public
<Directory /var/www/html/litprof/myproject/public>
Options FollowSymLinks
AllowOverride All
</Directory>
My Answer:
It looks like the issue might be with your Apache configuration.
In your .htaccess file in the public directory, you have specified the RewriteBase as /myproject/. This might be causing the redirect issue when using redirect()->back().
You can try removing the RewriteBase line from your public/.htaccess file and see if that resolves the issue.
Additionally, make sure that your Apache configuration is set up correctly to point to the public directory of your Laravel project.
If the issue persists, you may need to check your Laravel routes and make sure that the redirect()->back() is being used correctly.
If you continue to experience issues, you may want to consider reaching out to Laravel support or consulting with a developer familiar with Laravel and Apache configuration.
Rate this post
4 of 5 based on 4109 votesComments