Jump to content

Redirect index.php urls to parent


Rscott5983
 Share

Recommended Posts

Hi Guys,

 

I have a client with a strange set up. In analytics we are seeing urls getting pageviews that technically dont exist.

Example: website.org/questions/search/blog/2016/07/blog-post-name/index.php

The current ht access file looks like this but all that does is redirect these blog urls to the home page.

# Redirect index.php Requests
# ------------------------------
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{THE_REQUEST} !/system/.*
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,L]

Is there an htaccess code to handle all pages like this (redirect urls ending in /index.php):

Example: website.org/questions/search/blog/2016/07/blog-post-name/index.php

to: website.org/questions/search/blog/2016/07/blog-post-name/

I can do this on a url by url basis buy the same happens every time a new post is created.

Thanks

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...