apache .htaccess - cut a string from url and redirect

前端 未结 2 2031
别那么骄傲
别那么骄傲 2021-01-24 08:05

For some reason google indexed several pages of my website as:

http://myapp.com/index.php/this-can-be-enything/1234

Now, I want to redirect wit

2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-24 08:27

    I've added to my .htaccess file following lines:

    RewriteCond %{THE_REQUEST} ^.*index.php.*
    RewriteRule ^(.*)index.php(.*)$ $1$2 [NC,R=301,L]
    

    I don't know if this is best solution but works ok for me.

提交回复
热议问题