How to remove part of URl with .htaccess?

后端 未结 5 484
星月不相逢
星月不相逢 2020-12-09 20:28

Currently i have 20+ URLs on my site in this formate

http://www.example.net/content/index/mission

I want to remove /content/index from all URLs, so they shou

5条回答
  •  半阙折子戏
    2020-12-09 21:05

      # Get rid of index.php
      RewriteCond %{REQUEST_URI} /index\.php
      RewriteRule (.*) index.php?rewrite=2 [L,QSA]
    
      # Rewrite all directory-looking urls
      RewriteCond %{REQUEST_URI} /$
      RewriteRule (.*) index.php?rewrite=1 [L,QSA]
    

    Or just add index.html depending on whatever extention you want to remove and MOD_REWRITE is required on Apache for this to work. Thank you.

提交回复
热议问题