.htaccess file did not apply (removing .php extension) - php

I tried only remove the .php extension by using the .htaccess file on my XAMPP localhost server. I put the following lines into it:
RewriteEngine On
RewriteOptions inherit
Options +FollowSymlinks
Options -Multiviews
## hide .php extension
## To externally redirect /dir/foo.php to /dir/foo
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
I have tried more options to accomplish my goal, but nothing changed. Did I do something wrong?

Check if you have AllowOverride All in the httpd.conf file (the configuration file for apache). If you are using XAMPP on Windows, then the httpd.conf file should reside in a directory like :
C:\xampp\apache\conf\httpd.conf
Add the AllowOverride All line in the Directory tag. For example:
<Directory C:\xampp\htdocs>
AllowOverride All
Allow from all
</Directory>
P.S. By allowing override you tell the server to allow the .htaccess file to override the default configuration of the server.
Edit: Sorry that I previously mentioned AllowOverride 'On'. It should be AllowOverride 'All'. This works fine in my ubuntu. I'll try to find out how to make it work in windows(xampp) soon.

The following works for me on apache2. Hopefully it will work on XAMPP as well.
This is nearly the same as your code, but it checks that the requested filename doesn't exist, and that the PHP file does exist.
RewriteEngine On
RewriteOptions inherit
Options +FollowSymlinks
Options -Multiviews
## hide .php extension
## To externally redirect /dir/foo.php to /dir/foo
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ %{REQUEST_FILENAME}\.php [NC,L]

Related

How can you fetch a name from a Directory like you do with $_GET in PHP? [duplicate]

I want a mod_rewrite rule set, so I can refer to a page without the .php extension, but have that rewritten to include the .php extension. This will be running on a 1&1 server.
Are there any good references so I can learn more myself?
RewriteEngine On
RewriteRule something something.php [L]
http://example.com/something will be handled as if it was a request for something.php
To redirect all requests that are not a physical file to the same name but with .php:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule (.*) $1.php [L]
The accepted answer above does not remove the .php extension from urls it just allows you to visit .php files without extension. To remove the .php extension completely from urls , you can use the following Rules in root/.htaccess :
RewriteEngine on
#1)externally redirect "/file.php" to "/file"
RewriteCond %{THE_REQUEST} /([^.]+)\.php [NC]
RewriteRule ^ /%1 [NC,L,R]
#2)Internally map "/file" back to "/file.php"
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ /$1.php [NC,L]
Probably what you really want is just a way to not have the suffix at all. The
best way I've found of doing this is to use the Files directive in .htaccess or in
apache configuration files:
<Files myscript>
SetHandler cgi-script
</Files>
This avoids some of the downsides of rewrites, e.g., direct access of the .php
file.
.htaccess file: add the following lines:
Options +MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
https://alexcican.com/post/how-to-remove-php-html-htm-extensions-with-htaccess/
Now you would have to check for the AllowOverride condition in apache2.log file:
set options AllowOverRide All in your web root directory:
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
If you try to access your webpage without the .php extension, you may run into the following error in your apache error.log file:
/var/www/html/web/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
To fix this: You don't have the mod_rewrite module installed, To install it:
Run the following command: ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
Again, after refreshing the webpage, you might get the folloowing error in error.log file:
[negotiation:error] [pid 4650] [client 127.0.0.1:46461] AH00687: Negotiation: discovered file(s) matching request: /var/www/html/web/test (None could be negotiated). (I was trying to access localhost/web/test.php using the url: localhost/web/test)
To fix it you would have to add the following lines in apache2.conf:
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .html
AddType application/x-httpd-php-source .phps
</IfModule>
https://forums.digitalpoint.com/threads/htaccess-addtype-application-x-httpd-php-php-htm-html-and-maybe-a-fix.7584/#post-2491687
Now, I can access the test.php file using just the filename: test
For some reason I wasn't able to get any other solution working properly. I put this in an .htaccess file at the root of my site. Hopefully this will work for you.
RewriteEngine on #only use this once per .htaccess
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
It's important to keep in mind that if your header or URL contains the .php extension it won't be removed. You'll need to remove the extension.
Use this...
header 'location: /login';
rather than this...
header 'location: /login.php';
This Option will make clean SEO friendly URL's. Removing.php extensions from the visible URL, and ensuring that URL's accessed without the .php will still display the .php file. I was unable to find another answer that achieved this on multiple threads.
Remember to enable mod rewrite. On Debian or Unbuntu linux the following will work
sudo a2enmod rewrite
and
sudo service apache2 restart
Modify the corresponding section of your apache2.conf file to the following.
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.php [L]
RewriteCond %{THE_REQUEST} /([^.]+)\.php [NC]
RewriteRule ^ /%1 [NC,L,R]
</Directory>
If using .htaccess to re-write ensure that the apache2.conf at least has these options enabled.
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine On
</Directory>
Finally on some Apache install you may need to also set
AllowOveride All
in a .conf file in /etc/apache2/sites-available or /etc/apache2/sites-enabled.
Rewriting from apache2.conf file as opposed to .htaccess is rumored to be faster.
To get http://example.com/test linking http://example.com/test.php use:
RewriteEngine on
RewriteRule ^([^\.]+)$ /folder/$1.php [NC,L]
For directing a few single files it might be easier to avoid the RewriteEngine.
I've used this:
<Files $filename>
SetHandler application/x-httpd-php
</Files>
That's less powerful and flexible than rewrite but probably faster and seems like the way to go if you wish to just have a few specific files handled as PHP.
RewriteEngine On
# Redirect sites with no extension to .php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule .* %{REQUEST_URI}.php
This is what I came up with. This is based off of the accepted answer and its comments.

Laravel 5 needs index.php using Apache virtual host

When I load pages that are not root, the page won't load without index.php before the route. The error I get:
Not Found
The requested URL /login was not found on this server.
Apache/2.4.7 (Ubuntu) Server at mydomain.com Port 80
To start with I have a virtual host file containing:
//also tried adding DirectoryIndex here before <directory>
<directory /var/www/mydomain.com>
DirectoryIndex index.php
AllowOverride ALL
</directory>
and a .htacces in my public with :
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I have another domain with the same .htaccess and appache config on the same server and it works fine. Also I did restart apache. If I use phpinfo on my index.php/route page I see at Loaded Modules:
mod_rewrite mod_setenvif
When running the website localy with xampp everything works fine.
For hours i'm trying now but I can't fix it or find any error (logs are empty) or any solutions that I haven't tried yet.
Edit:
Im using Ubuntu Ubuntu 14.04 x64 on a digital ocean VPS. And I tried turning it on and off again (as suggested). PHP Version 5.5.9-1ubuntu4.9. I followed this tutorial to config everything (except the direcoty part). I changed the location of the apache log and a file error.log is created on the given directory but no errors are in it.
My currently appache config is : (i've triple checked the white parts where the domain name is).
When I run apache2ctl -t D DUMP_VHOSTS I get
this looks fine to me, also tried disabling the default config but it didnt help.
Note: i've replaced my real domain with mydomain.com in reality I use my real domain on these spots.
Thought how do I know for sure that the conf file im editing is the one being used by the domain?
This is the correct Alternative htaccess rule for Laravel 5 suggested to use when the default doesn't work:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
The Options +FollowSymLinks I believe plays an important role because the DirectotyIndex acts like a symlink.
Also check /app/config/app.php to make sure you haven't set the Config('app.url') to contain the index.php.
If you have laravel installed in a sub-directory see this:
How can I remove "public/index.php" in the url generated laravel?
Have you tried turning it all off (shutdown), and then turning it on again?
If everything is as you say, it should work. I would try a restart to see if it changes anything.
If it doesn't, please update with what OS you are using.
I ended up deleting the complete conf file and copied it again from the one thats working. I took the default .htaccess from laravel and it worked. Unfortunately I still dont know what was wrong though. The current conf file looks like
<Directory /var/www/mydomain.com>
AllowOverride ALL
DirectoryIndex index.php
</Directory>
My .htaccess in /public
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I had almost exactly the same problem today, which #dasper also helped me out on. I am using digital ocean Ubuntu 14.04 also, and I had to run the command a2enmod rewrite then reload apache2. It seemed that even though rewrite appeared to be on, it actually wasn't.
First, make sure mode_rewrite is enabled. I am sure you have probably done this but I want to make sure nothing is missed.
Next, see what version of apache you are running since the syntax has changed between 2.2 and 2.4. This should not be a big deal and highly doubt this is the culprit but could save you trouble in the future
Next, try putting the rewrite condition inside of the vhost information instead of the htaccess file. This can help a little with performance as well as give you a console warn/err when restarting apache where the htaccess errors could be squelched.
<directory /var/www/mydomain.com>
Options -MultiViews
AllowOverride ALL
RewriteEngine On
RewriteRule ^(.*)/$ /$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</directory>
Beyond this point I would be at a loss without some more logging or information from the server. You can also add CustomLog into the vhost and report all requests processed by the server.
The problem could be with your virtual host configuration and/or a misplaced .htaccess file.
Make sure your .htaccess file is in the public/ folder and that the DocumentRoot is set to that public/ folder.
And also, the < Directory> directive isn't controlling your virtual host but rather controls the folder itself and how it can be (or can't be) accessed on the server. To change the configuration of the virtual host do so inside the < VirtualHost> directive.
Here is an example of a virtual host configuration:
<VirtualHost *:80>
ServerName mydomain.com
ServerAlias www.mydomain.com
DocumentRoot "/var/www/mydomain.com/public"
DirectoryIndex index.php
</VirtualHost>
Here is the default Laravel Apache config:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
and here is an alternative:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Try to rename the server.php in the your Laravel root folder to index.php and copy the .htaccess file from /public directory to your Laravel root folder.
Solution found here
I believe your directory path is wrong. You need /public on the end because Laravel treats that directory as the web root. Try this:
<directory /var/www/mydomain.com/public>
DirectoryIndex index.php
AllowOverride ALL
</directory>
But the better solution is to put the contents of the .htaccess file in your virtual host. Like this:
<VirtualHost *:80>
DocumentRoot "/var/www/mydomain.com/public"
ServerName mydomain.com
ServerAlias *.mydomain.com
<Directory "/var/www/mydomain.com/public">
# Ignore the .htaccess file in this directory
AllowOverride None
# Make pretty URLs
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
</Directory>
</VirtualHost>
Also, you should make sure your config file is loaded by running:
apache2ctl -t -D DUMP_VHOSTS
This will print a list of all the loaded vhosts. If yours isn't in that list then make sure it is enabled by running:
a2ensite [name_of_your_config_file]
Then restart apache with:
service apache2 reload
One more note: don't forget to edit /etc/hosts and add 127.0.0.2 yourdomain.com

.htaccess redirects to a template selection php file

How would I configure my .htaccess file if I want all requests to always load a core template selection file. I believe this could be good for a few reasons the first of which being security. Only if my php template selection code flags a file as safe for display will it display. Also, it allows me to build some interesting cms functionality like requiring a php metadata array in order to load the template file. How could I accomplish this?
Also, do you think it is practical to choose this method over others?
You can use this rule in your root .htaccess to make core/template.php your front controller:
RewriteEngine on
RewriteBase /
RewriteRule ^core/template\.php$ - [L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . core/template.php [L]
EDIT: If you want even real files to be routed to same controller use last rule as:
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule !\.(jpe?g|ico|gif|bmp|png|tiff|css|js)$ core/template.php [L,NC]
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteRule ^(.*)$ /index.php
</IfModule>
Make sure that inside the httpd.conf this line isn't commented:
LoadModule rewrite_module modules/mod_rewrite.so
(It should be without the '#' at the beginning)
And this is my directory tag (I'm using wamp but it should be the same, and of course restart the apache server if you changed something there)
<Directory />
Options FollowSymLinks
AllowOverride All
Order deny,allow
Allow from all
</Directory>

Removing .php also messes up folders [duplicate]

I want a mod_rewrite rule set, so I can refer to a page without the .php extension, but have that rewritten to include the .php extension. This will be running on a 1&1 server.
Are there any good references so I can learn more myself?
RewriteEngine On
RewriteRule something something.php [L]
http://example.com/something will be handled as if it was a request for something.php
To redirect all requests that are not a physical file to the same name but with .php:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule (.*) $1.php [L]
The accepted answer above does not remove the .php extension from urls it just allows you to visit .php files without extension. To remove the .php extension completely from urls , you can use the following Rules in root/.htaccess :
RewriteEngine on
#1)externally redirect "/file.php" to "/file"
RewriteCond %{THE_REQUEST} /([^.]+)\.php [NC]
RewriteRule ^ /%1 [NC,L,R]
#2)Internally map "/file" back to "/file.php"
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.*?)/?$ /$1.php [NC,L]
Probably what you really want is just a way to not have the suffix at all. The
best way I've found of doing this is to use the Files directive in .htaccess or in
apache configuration files:
<Files myscript>
SetHandler cgi-script
</Files>
This avoids some of the downsides of rewrites, e.g., direct access of the .php
file.
.htaccess file: add the following lines:
Options +MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,L]
https://alexcican.com/post/how-to-remove-php-html-htm-extensions-with-htaccess/
Now you would have to check for the AllowOverride condition in apache2.log file:
set options AllowOverRide All in your web root directory:
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
If you try to access your webpage without the .php extension, you may run into the following error in your apache error.log file:
/var/www/html/web/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
To fix this: You don't have the mod_rewrite module installed, To install it:
Run the following command: ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/rewrite.load
.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
Again, after refreshing the webpage, you might get the folloowing error in error.log file:
[negotiation:error] [pid 4650] [client 127.0.0.1:46461] AH00687: Negotiation: discovered file(s) matching request: /var/www/html/web/test (None could be negotiated). (I was trying to access localhost/web/test.php using the url: localhost/web/test)
To fix it you would have to add the following lines in apache2.conf:
<IfModule mod_mime.c>
AddType application/x-httpd-php .php
AddType application/x-httpd-php .phtml
AddType application/x-httpd-php .php3
AddType application/x-httpd-php .php4
AddType application/x-httpd-php .html
AddType application/x-httpd-php-source .phps
</IfModule>
https://forums.digitalpoint.com/threads/htaccess-addtype-application-x-httpd-php-php-htm-html-and-maybe-a-fix.7584/#post-2491687
Now, I can access the test.php file using just the filename: test
For some reason I wasn't able to get any other solution working properly. I put this in an .htaccess file at the root of my site. Hopefully this will work for you.
RewriteEngine on #only use this once per .htaccess
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
It's important to keep in mind that if your header or URL contains the .php extension it won't be removed. You'll need to remove the extension.
Use this...
header 'location: /login';
rather than this...
header 'location: /login.php';
This Option will make clean SEO friendly URL's. Removing.php extensions from the visible URL, and ensuring that URL's accessed without the .php will still display the .php file. I was unable to find another answer that achieved this on multiple threads.
Remember to enable mod rewrite. On Debian or Unbuntu linux the following will work
sudo a2enmod rewrite
and
sudo service apache2 restart
Modify the corresponding section of your apache2.conf file to the following.
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) $1.php [L]
RewriteCond %{THE_REQUEST} /([^.]+)\.php [NC]
RewriteRule ^ /%1 [NC,L,R]
</Directory>
If using .htaccess to re-write ensure that the apache2.conf at least has these options enabled.
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
RewriteEngine On
</Directory>
Finally on some Apache install you may need to also set
AllowOveride All
in a .conf file in /etc/apache2/sites-available or /etc/apache2/sites-enabled.
Rewriting from apache2.conf file as opposed to .htaccess is rumored to be faster.
To get http://example.com/test linking http://example.com/test.php use:
RewriteEngine on
RewriteRule ^([^\.]+)$ /folder/$1.php [NC,L]
For directing a few single files it might be easier to avoid the RewriteEngine.
I've used this:
<Files $filename>
SetHandler application/x-httpd-php
</Files>
That's less powerful and flexible than rewrite but probably faster and seems like the way to go if you wish to just have a few specific files handled as PHP.
RewriteEngine On
# Redirect sites with no extension to .php
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteCond %{REQUEST_URI} !/$
RewriteRule .* %{REQUEST_URI}.php
This is what I came up with. This is based off of the accepted answer and its comments.

The url requested was not found laravel 4

I'm trying to create an app with laravel 4 but i'm facing a url issue. i have wamp installed on my machine. i set up a new virtual host in my httpd-vhost.conf with this code
<VirtualHost mobile.dev>
DocumentRoot "C:\wamp\www\mobile.dev\public"
ServerName mobile.dev
<Directory "C:\wamp\www\mobile.dev">
Options FollowSymLinks Indexes
AllowOverride All
Order deny,allow
Allow from 127.0.0.1
Deny from all
Require all granted
</Directory>
mobile.dev is a folder and also the domain name in my localhost.
here is my Route.php file
Route::get('/','HomeController#showWelcome');
Route::post('login','LoginController#userLogin');
Route::get('login','LoginController#getUsers');
when i ask for mobile.dev/login it gives me the requested url was not found.
can you help me please solve this issue. but when i ask for mobile.dev/ its working.
Here is my .htaccess file :
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
Here is more details. when i remove my htaccess content everything works fine with the default url http://mobile.dev/index.php/login
So the problem is in my htaccess and the rewriting in my virtual host
It might be not Laravel problem, but seems your wamp server haven't enabled mod_rewrite in httpd.conf file yet. Locate the line -
#LoadModule rewrite_module modules/mod_rewrite.so
and remove the comment symbol '#'. Then save the file and restart Apache.
Solution:
1- when you have wamp installed in your machine please go to C:\wamp\bin\apache\Apache*.*.*\conf\httpd.conf and make sure that rewrite_mod is enabled by deleting the hash tag. (instead of using the interface provided by wamp)
2-there are two ways to enable rewriting for laravel in .htaccess file :
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes...
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
or using this :
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
3- if you're setting a virtual host be sure to add this option in the <virtualhost> tag
<Directory "C:\wamp\www\mobile.dev\public">
Options FollowSymLinks Indexes Multiviews
AllowOverride All
</Directory>
Thanks a lot for your time.
Have you tried
Route::post('login','LoginController#userLogin');
without the () after userLogin?
Your <Directory "C:\wamp\www\mobile.dev"> in config should be <Directory "C:\wamp\www\mobile.dev\public"> to specify the public directory to the root of the htaccess rewrite rules.
I originally thought you were missing the </IfModule> at the end of your .htaccess file but when I posted my .htaccess file it hid the </IfModule> as well so that is a stack overflow issue. Otherwise your htaccess is correct.

Categories