开发者

remove index.php from url using .htaccess

开发者 https://www.devze.com 2023-03-12 10:33 出处:网络
I want to redirect normal pages so that users and 开发者_StackOverflowbots don\'t access the domian.com/index.php/pagename version of the pages.

I want to redirect normal pages so that users and 开发者_StackOverflowbots don't access the domian.com/index.php/pagename version of the pages.

I am currently using this solution:

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

This however also redirects domain.com/admin/index.php/variables which stops me being able to access the admin area.

So, how to redirect domain.com/index.php/pagename to domain.com/pagename without affecting domain.com/admin/index.php/variables


The RewriteRule command is pointing any URL with 'index.php' in it to another page. Try changing the second command to:

RewriteRule ^(index.php)(.*)$ /$1 [NC,R=301,L]
0

精彩评论

暂无评论...
验证码 换一张
取 消