MVC URL Redirection

I am currently using a custom MVC architecture to build my site.

The problem is that when I enter localhost / website /, which will be www.website.com/ in the future, I want my page to be shown. I am currently doing this work using localhost / website / home /, but I do not want this, I just want localhost / website /, which automatically displays the home page.

I tried to do this with htaccess, but without any success. When I go to localhost / website /, it shows me the error "This web page is not available."

My htaccess code: it is inside my public folder.

     <IfModule mod_rewrite.c>
         RewriteEngine On

         RewriteCond %{REQUEST_FILENAME} !-f
             RewriteCond %{REQUEST_FILENAME} !-d

        RewriteRule ^(.*)$ index.php?url=$1 [PT,L]

        </IfModule>
        <IfModule !mod_rewrite.c>
            ErrorDocument 404 index.php
        </IfModule>

I hope this made some sense and that someone could help me.

thank

+4
2

, :

<IfModule mod_rewrite.c>
    RewriteEngine On

    # handle home page
    RewriteRule ^/?$ home [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
</IfModule>

<IfModule !mod_rewrite.c>
   ErrorDocument 404 index.php
</IfModule>
+2

: RewriteEngine On :

RewriteRule ^$ index.php?url=home [L]
0

Source: https://habr.com/ru/post/1569449/


All Articles