Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

JRomero

macrumors regular
Original poster
Jun 29, 2006
115
0
Hello all,

A few years back, I had a Wordpress site that used the ?p= suffix to the url to display posts. Currently, I no longer have the Wordpress site, but one of my posts still gets lots of traffic. Is there I could point ?p=40 to some other page or directory?

Thanks for your help,
Jason
 
You can use a .htaccess file redirect.
Code:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^p=40$
RewriteRule .* /newpage.html [L]
 
Thanks to the both of you for your help!

SilentPanda, I tried making a p.php page, but it didn't do anything, unfortunately. :(

angelwatt, I was hoping somebody new how to write a proper .htaccess RewriteRule! :D Unfortunately, when I use this, the ?p=40 leads to 500 Internal Server Error. Could there be an alternate RewriteRule I could try?
 
Can you show what you put in your .htaccess file? Syntax is very key. The 500 error generally means it doesn't understand something in the .htaccess file. Also, do you know the web server version?
 
Can you show what you put in your .htaccess file? Syntax is very key. The 500 error generally means it doesn't understand something in the .htaccess file. Also, do you know the web server version?

This is what is in my .htaccess:

RewriteEngine On
RewriteCond %{QUERY_STRING} ^p=40$
RewriteRule .* /iphone.php [L]

I have a Linux server with Apache version 2.0.63
 
That looks good. I found this page where the guy is wanting to do the same thing as you. It looks like the main differences are that he's redirecting to another domain and on the rule line he's using ^$ rather than .*, which could make a difference. He's also using a redirect code (the 301) at the end, which is a good idea too so the search engines will update their index when they hit it.

Code:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^p=40$
RewriteRule ^$ /iphone.php [R=301,L]
 
angelwatt! That did the trick! Thank you very much!!! :D
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.