• Hi – I am setting up redirects in a website and am having a hard time figuring this out so I’m hoping someone can help. There is a “highlights” plugin on the front page. When you publish a page with this highlights, you get the following URL (with the “highlights” section added to the URL):

    https://www.regions.noaa.gov/gulf-mexico/highlights/restore-act-passed/

    The problem I’m having is this entire website is messed up (I’m taking over for the previous support person) so in order to get all of the links in the site working, I had to inject “index.php” into all URLs to get the site working like the customer wants. However, when “index.php” is injected into the “highlights” URLs, they no longer work. For example, here is a page with “index.php” injected that works:

    https://www.regions.noaa.gov/gulf-mexico/index.php/regional_team/

    But here is a page with “index.php” and “highlights” that does not work:

    https://www.regions.noaa.gov/gulf-mexico/index.php/highlights/restore-act-passed/

    So all you have to do is go up to the URL window and delete “index.php” from the above URL and then the page works:

    https://www.regions.noaa.gov/gulf-mexico/highlights/restore-act-passed/

    So to get this thing working, I want to redirect the highlights pages in htaccess. I tried the first line of code below in htaccess to try to fix the “highlights” error and it did not work. The rest of the code is the rewrite for the other issue I’m having. I’ve got that redirect code at the top so it hits before it gets to the rest of the code.

    Any advice is appreciated.

    ———————————

    THE HTACCESS CODE:

    # to redirect to the working highlights url
    Redirect /index.php/highlights/restore-act-passed/index.php /highlights/restore-act-passed/index.php

    RewriteEngine On
    RewriteBase /wp-testing/
    RewriteRule ^index\.php$ – [L]

    # add a trailing slash to /wp-admin
    RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]

    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ – [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
    RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
    RewriteRule . index.php [L]
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /gulf-mexico/
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /gulf-mexico/index.php [L]
    </IfModule>

  • The topic ‘Htaccess code not redirecting to correct page – please help’ is closed to new replies.