I need to prevent this urls:
index.php/test/ must be redirect to index.php
index.php/test/test/ must be redirect to index.php

I need this to be automatically, because i have multiple pages (index.php, team.php and etc...)
Without bring the names of the pages in htaccess

Important: i have this urls:
index.php?page=5 (this need's to be working fine)

Recommended Answers

All 3 Replies

try:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteRule ^/?index\.php\/(.*)$    /index.php [R=301,L]
</IfModule>

Important: i have this urls: index.php?page=5 (this need's to be working fine)

Won't this rule redirect these pages as well?

Won't this rule redirect these pages as well?

No. Those pages start with a question mark immediately after index.php. The RewriteRule above only affects pages that have a forward slash immediately after index.php.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.