Remove index.php from url by htaccess

前端 未结 4 1233
时光取名叫无心
时光取名叫无心 2020-12-22 12:31

Im developing a php frame work and I am new to .htaccess rules. So I need to redirect url using .htaccess. Url is

http://localhost/rinocabs/index.php?/Galar         


        
4条回答
  •  爱一瞬间的悲伤
    2020-12-22 12:37

    Options +FollowSymLinks -MultiViews
    # Turn mod_rewrite on
    RewriteEngine On
    RewriteBase /
    
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?$1 [L,QSA]
    
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s(.*)/index\.php [NC]
    RewriteRule ^ %1 [R=301,L]
    

    use this

    localhost/rinocabs/index.php/Galary/Image/

    instead of

    localhost/rinocabs/index.php?/Galary/Image/

提交回复
热议问题