Laravel .htaccess

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews -Indexes
    </IfModule>

    RewriteEngine On

    # 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>

The above is my Laravel .htaccess, and yet I am unable to get laravelx.com/login or register page. laravelx.com is a domain configured in the public folder of laravel install on XAMPP.




Over the internet, I was studying the .htaccess and found some sensible thing and then I tried on my local server where I configured a pseudo domain:
mvc.com . It has
index.php →

<?php 
/**
* Front controller
*
* PHP version 8.0
*/

echo 'Requested URL ="' . $_SERVER['QUERY_STRING'] . '"';
echo "<br />" . phpversion();

and then .htaccess has:

# Remove the question mark from the request but maintain the query string
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L,QSA]

This was able to get me rid of index.php, but it still requires ?/ part.

GIF is explanatory:
url

The similar issue I am facing with laravel. Can there be an issue with XAMPP?

1 Like

Although It was my troubleshooting and no one else concern, but since I have posted so I am further updating that when I exit from XAMPP and installed wamp with same files and domain configuration my latest example started to work. so it seems to me that the prroblem was created by XAMPP.

With WAMP it worked →

can some one guide me how to look upon why XAMPP had an issue and it worked with WAMP.

May be Laravel installtion may also work on WAMP.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.