0
http://my-domain.com/ppc-landing-page.php?Campaign=Boynton-Beach&AdGroup=Security%20System&Keyword=The%20Best%20Home%20Security%20System%20Company

I want this to be rewritten as

http://my-domain.com/Boynton-Beach/Boynton-Beach.php?Campaign=Boynton-Beach&AdGroup=Security%20System&Keyword=The%20Best%20Home%20Security%20System%20Company

and display the content inside ppc-landing-page.php

The idea is to get the value of Campaign query parameter and rewrite the url in the browser to

http://my-domain.com/{$_GET['Campaign']}/{$_GET['Campaign']}.php?Campaign=Boynton-Beach&AdGroup=Security%20System&Keyword=The%20Best%20Home%20Security%20System%20Company

the full query string should be there

and then it should replace the $_GET values in the ppc-landing-page.php with the values in the query string and display the content.

2 Answers 2

1

Try the following RewriteRule in the .htaccess of your site's document root

RewriteEngine On

RewriteBase /
RewriteCond %{QUERY_STRING} campaign=([^&]+) [NC]
RewriteRule ppc-landing-page.php %1/%1.php [R=302,L]
Sign up to request clarification or add additional context in comments.

3 Comments

Great it worked...But then I need to show the content of ppc-landing-page.php instead %1/%1.php. How am I going to do that ?
What do you mean? What's the address you expect in the browser?
I want the address to be %1%1.php but content to be from ppc-landing-page.php
0
RewriteCond %{REQUEST_URI} !^/ppc-landing-page.php
RewriteCond %{QUERY_STRING} campaign=([^&]+) [NC]
RewriteRule ^(.*)$ ppc-landing-page.php [L,QSA]

RewriteCond %{REQUEST_URI} ^/ppc-landing-page.php
RewriteCond %{QUERY_STRING} campaign=([^&]+) [NC]
RewriteRule ppc-landing-page.php %1/%1.php [R=302,L]

Now I have put something like this...First it worked now it's not ???

1 Comment

@arco444 I put my htaccess here..Please tell me will this do the trick ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.