Question

htaccess redirection not working

Hello! I'm new to htaccess so don't judge me please Happy.
I have the following problem - I'm making a website in my local server /it's apache2/ and the project is located in the www/html/subFolder/MVC.
In the MVC folder I have the following structure
MVC
|-- .htaccess
|-- app
| |-- bootstrap.php
| |-- .htaccess
| |-- config
| |-- controllers
| |-- helpers
| |-- libraries
| | |-- controller.php
| | |-- core.php
| | `-- database.php
| |-- models
| `-- views
`-- public
|-- .htaccess
|-- css
|-- img
|-- index.php
`-- js

The problem is that I try to make a redirect rule for the public folder. For example when the user try to open MVC/public/test.php /some file that doesn't exist/ it should redirect it to the MVC/public/index.php, but my rule doesn't work
Here is my htaccess file in the public folder
<IfModule mod_rewrite.c> Options -Multiviews RewriteEngine On RewriteBase /MVC/public RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]</IfModule>


And here is my htaccess in the root folder
<IfModule> RewriteEngine on RewriteRule ^& public/ [L] RewriteRule (.*) public/$1 [L]</IfModule>

Discussion is locked

Follow
Reply to: htaccess redirection not working
PLEASE NOTE: Do not post advertisements, offensive materials, profanity, or personal attacks. Please remember to be considerate of other members. If you are new to the CNET Forums, please read our CNET Forums FAQ. All submitted content is subject to our Terms of Use.
Reporting: htaccess redirection not working
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Comments

CNET Forums

Forum Info