Redirection to index.php through .htaccess



  • I've got a LP-type website, with reference clips in the menu, covered to the appropriate block. And the URLs look like: http://site/city/interiors I did the url through history.pushState. i.e. all the evidence in the menu is kept in the history of the browser.

    I need to make sure that when the browser's history moves, the index page of the index.php.

    I tried to do this:

    RewriteEngine On
    RewriteBase /
    

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

    RewriteRule ^(.*)$ index.php?$1 [L,QSA]

    But in this case, it's like index.php works, but it doesn't make sss styles, images, videos, it doesn't work.

    Then I tried that:

    AddType "text/html; charset=utf-8" .htm .html
    AddDefaultCharset utf-8
    PHP_VALUE default_charset utf-8

    RewriteEngine on
    RewriteCond %{HTTP:Accept-Language} (en|ru) [NC]
    RewriteBase /

    RewriteRule ^/([a-zA-z_-]+)/([a-zA-z_-]+)$ index.php?city=$1&block=$2

    But it doesn't work, index.php doesn't happen : Error 404
    Can you tell me how to fix this?

    Another important point: if url: http://site/admin , to redirect to index.php, which is not to occur at the root of the site.



  • I tried to do this:

    RewriteEngine On
    RewriteBase /
    

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

    RewriteRule ^(.)$ index.php?$1 [L,QSA]

    But in this case, it's like index.php works, but it doesn't make cs.
    Styles, images, videos-- it doesn't work.

    And css styles don't get caught as they're redirected to index.php

    You need to make a rule for styles, like:

    RewriteRule ^/css/(.).css$ css/$1.css [L,QSA]

    We'll put him above the general rule.


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2