.htaccess only working correctly within localhost/


  • | 669 points

    Hello. First time poster. I am creating an mvc in laragon using php and have my .htaccess file to rewrite. If I use localhost and type in the url localhost/myprojectname/public it should direct me to the index page. This is the behaviour that I want. Also, if I add to that test.php, it also keeps me on index.php. Again, this is the desired behaviour. However, when I try to use the same functionality using the built in website.test, the rewrite rule is ignored even if I add the .test to the url within the .htaccess file. If anyone can help me to get this to work using website.test in my .htaccess file, I would sure appreciate it. Thank you in advance. Here is the code I am using. The .htaccess in this case is in the public folder, not in the root folder.

      Options -Multiviews
      RewriteEngine On
      RewriteBase /projectname.test/public
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule  ^(.+)$ index.php?url=$1 [QSA,L]
    </IfModule>

Log in to reply
 

Looks like your connection to Laragon was lost, please wait while we try to reconnect.