0

Following is my URL rewrite code for a single page of my wordpress site.

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^mainparent\/subparent\/pseudopage\/$ /?page_id=3420 [PT]
</IfModule>

Have added above in htacess.

Issue is that, the browser URL is changed to actual page. Shouldnt it remain pseudopage in URL bar, since ReWrite is used?

How do maintain the pseudopage in URL bar, while displaying the content of /?page_id=3420 or /mainparent/subparent/actualpage/ (using htaccess)

  • 1
    Apache is rewriting the URL so that WordPress sees your path as ?page_id=3420, but then WordPress sees that the request is for a specific page and redirects to its canonical URL. – Jacob Peattie Nov 2 '19 at 8:39
  • So, how do I stop it from redirecting.. nothing happens if use /mainparent/subparent/actualpage/ or \/mainparent\/subparent\/actualpage\/ instead of /?page_id=3420 – Shailesh Nov 2 '19 at 10:20
  • I don’t have an answer, I was just leaving a comment explaining why this is happening. – Jacob Peattie Nov 2 '19 at 11:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.