WordPress .htaccess Redirect

I normally wouldn’t post on here and try to figure things out myself but I’m at my wits end.

I’m trying to perform a redirect in WordPress so that requests to:

Read More
/property/123-my-unique-uri-here

… get forwarded onto a file called /property-details.php but the URL remains the same in the address bar.

Here’s what I’ve tried:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^property/(.*)$ /wp-content/themes/Divi/property-details.php?uri=$1 [QSA,L]
</IfModule>

However, when I visit the URL /property/123-my-unique-uri-here I just got forwarded to the homepage.

If anyone has any ideas at all I’d be eternally grateful!

Related posts

Leave a Reply

1 comment

  1. try this:

    RewriteRule ^property/123-my-unique-uri-here$ /property-details.php?&%{QUERY_STRING}
    

    Another option is to just use a 301:

    RedirectMatch 301 /property/123-my-unique-uri-here(.*) /property-details.php$1