skip to Main Content

I would like to know if there is a way to redirect a URL that looks like this:

https://www.example.com/p=d3d82c7c

to

https://www.example.com/polls/poll?poll=d3d82c7c

using htaccess.

What I want to do is to create a more simple link for the users. Is that possible with htaccess only?

PS: the code at the end may change within each URL.

Thank you very much.

2

Answers


  1. You can use this method:

    Redirect 301 /en/php/project.html http://www.example.org/newpage.html
    
    Login or Signup to reply.
  2. With your shown samples, could you please try following. Please make sure you clear your browser cache before testing your URLs.

    RewriteEngine ON
    RewriteRule ^.*=(.*) polls/poll?poll=$1 [L]
    

    OR with your shown samples if your URI always starts with p then you could try following, but make sure either previous OR this only one of them should be used at a time.

    RewriteEngine ON
    RewriteRule ^p.*=(.*) polls/poll?poll=$1 [L]
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search