I have implemented the MVC model, when there is a request, .htaccess redirects to the webroot folder. How to make that used for a specific request (site.com/folder) redirected to another folder (folder)? Here is my .htaccess which lies at the root of the project.

<IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L] AddDefaultCharset utf-8 </IfModule> 
  • Do you want to bring your htaccess? - Naumov
  • @Naumov Posted by - niksib
  • @niksib, if my answer helped you, please vote for it and mark it as correct. - VenZell
  • 2
    Possible duplicate question: How to do everything at once in mod_rewrite? - aleksandr barakin

1 answer 1

In a good way, it is enough to exclude this URL from your routing and catch the request already in place in the desired folder. You can exclude URLs like this:

 <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_URI} !^/folder/ RewriteRule ^$ webroot/ [L] RewriteCond %{REQUEST_URI} !^/folder/ RewriteRule (.*) webroot/$1 [L] AddDefaultCharset utf-8 </IfModule> 
  • So gives an error - niksib
  • @niksib What kind of error? - VenZell
  • Server error! You have encountered your request. Either the CGI script is overloaded. Error 500 - niksib
  • Here is the error message “Server error!” CGI script. Error 500 ” - niksib
  • @niksib Everywhere or at the specified url? - VenZell