Forums

Rewrite URL in specific pages (2 posts)

  1. lightmar
    Member
    Posted 3 years ago #

    Hello,

    I have a problem I couldn't resolve:
    Let's say I have a page called "landing1".
    The url is: http://myblog.com/landing1/
    I want to be able to call a non-existing url like:
    http://myblog.com/landing1/my-magic-page
    and it will not display a 404 error, it will rewrite the url to:
    http://myblog.com/landing1/?kw=my-magic-page
    I want to do that only in specific pages and not in all of them.

    Any idea how to do that? plugin? php coding? htaccess?

    Thank you!

  2. Backup your .htaccess file first. Then in your .htaccess file try adding this line on top:

    RewriteRule ^my-magic-page http://myblog.com/landing1/?kw=my-magic-page [R=301,L]

    The 301 is the "Moved Permanently" status response. You may want to change that to 307 which is "Temporary Redirect" depending on what you are trying to accomplish.

    This will only work if you have mod_rewrite enabled.

Topic Closed

This topic has been closed to new replies.

About this Topic