php Redirects, noindexing & best practices.

The only reason I'm I'm looking for a hand coded solution is to avoid having another plugin sucking up resources. The lighter my WP site the happier I am, and if there's a simple hard coded method, I'll take it over a plug in any day.

And I'd rather stab myself in the eye with a pencil then maintain my own hack coding again. But each to their own :)
 


See, now this is the type of thing that irks me. You guys constantly preach about how efficient and up-to-date you are, while harping on me about being inefficient and not knowledgeable.

Then you turn around, and provide advice that throwing a bunch of "header('Location: ...');" tags in dozens of files is just as good as mod_rewrite.

You gotta be kidding me...

You are right.
The efficiency stack for redirects is:
1) httpd.conf on Apache
2) .htaccess
3) PHP files
 
Here, do this. First, delete the entire /resources/ directory, as you don't need it. All that does is confuse things in order to make them more inefficient, which obviously doesn't make any sense.

Instead, add the following lines to your .htaccess file in your /public_html/ directory (if .htaccess doesn't exist, create it).

Code:
RewriteEngine on
RewriteRule ^resources/myalias$ http://www.domain.com/some/uri [L,R=301]
RewriteRule ^resources/abcpartner$ http://www.anotherdomain.com/uri/blah [L,R=301]
RewriteRule ^resources/superman$ http://www.thirddomain.com/uri/blah [L,R=301]
And so on... just add one line like above for each redirect, and that's all you need.
 
hi guys. am new to design and development. am interested to learning any one could u pls give a way to online platform for designing course? which is the best site to learn ?
 
Hey Matt,

I went ahead and changed all the links into .htacces but it's giving me an internal server error. I've read that there are some characters that often don't jive in .htaccess and need to be changed or broken up with a \ etc. Can I send you what I added and maybe you can spot what's causing the 500 error? Thanks.
 
Hey Matt,

I went ahead and changed all the links into .htacces but it's giving me an internal server error. I've read that there are some characters that often don't jive in .htaccess and need to be changed or broken up with a \ etc. Can I send you what I added and maybe you can spot what's causing the 500 error? Thanks.

Find your apache error logs and send those, a 500 error could literally be caused by anything, without error logs it's a needle in a haystack problem.
 
hi guys. am new to design and development. am interested to learning any one could u pls give a way to online platform for designing course? which is the best site to learn ?

er... I think you're in the wrong thread... or forum!

efeezy - What Matt's got looks fine to me and I'd certainly agree .htaccess is the place to do it - also agree with hand-coding if you don't have tonnes of them - avoid wp plugins as much as possible for a few good reasons.

Stupid as it may sound have a check there are no simple syntax errors in your expressions - even extra spaces etc. A good deal of 500 errors I've seen have been a case of one line being slightly wrong, but dchuk is bang on - you need to check your error logs or you're searching for Higgs Boson with a magnifying glass.

edit: Also I think what you're talking about with the escape characters is more likely to be the output of certain text editors.
 
Thanks. Yeah we got the 500 server error sorted out. But none of the links want to redirect. They just go to the 404 page for the original link.

So if I added the code below

Code:
RewriteEngine on
RewriteRule ^resources/theoffer.php$ http://www.sddedss.com/hn65js0ys-FNGHPHGMFHHHMNJMM?sid=tracking [L,R]

my on page links are /resources/theoffer.php, but they won't take the redirect, they just pull up a 404 since I've removed the /resources directory. Can't figure out what the deal is. I though maybe I needed to wrap the rewrite expression in <IfModule mod_rewrite.c></IfModule>, but that didn't help.




er... I think you're in the wrong thread... or forum!

efeezy - What Matt's got looks fine to me and I'd certainly agree .htaccess is the place to do it - also agree with hand-coding if you don't have tonnes of them - avoid wp plugins as much as possible for a few good reasons.

Stupid as it may sound have a check there are no simple syntax errors in your expressions - even extra spaces etc. A good deal of 500 errors I've seen have been a case of one line being slightly wrong, but dchuk is bang on - you need to check your error logs or you're searching for Higgs Boson with a magnifying glass.

edit: Also I think what you're talking about with the escape characters is more likely to be the output of certain text editors.
 
Helpful info guys. Just to add to this, if I wanted to blank the referrer, or at least remove the main site from showing up in affiliate systems as the referring URL, is the only way to do that to send it through another site in my control with a redirect to the LP or URL shortener?
 
Helpful info guys. Just to add to this, if I wanted to blank the referrer, or at least remove the main site from showing up in affiliate systems as the referring URL, is the only way to do that to send it through another site in my control with a redirect to the LP or URL shortener?

If you sent it through an https site and redirected from there to an http LP the referrer would be removed.

I'm sure you could rewrite or spoof it in a few other ways without the extra hop too.
 
whats this beef between Darrin and Kiopa_Matt?

None that I am aware of, I just give him a hard time for reinventing the wheel all the time and I think he thinks this thread is proof that I am guilty of my own criticism when in reality I was just answering the question.
 
my on page links are /resources/theoffer.php, but they won't take the redirect, they just pull up a 404 since I've removed the /resources directory. Can't figure out what the deal is.

Sorry for such a late response, but finally back to feeling decent. If this is still an issue, just contact your web host, and tell them:

"Please make sure 'Options All' and 'AllowOverride All' directives are set within Apache for my document root".

Once done, the 404s should disappear, and redirects will begin working fine. This is assuming your server is running Apache, but if it's running Nginx or something, let me know as redirects work a little differently.
 
whats this beef between Darrin and Kiopa_Matt?

It's just him and mattseh mainly, among others, like to make modest little quips as to how I don't understand what I'm doing, and am only making things harder on myself.

No worries, almost back to feeling 100% here. We'll be having a WF developer competition soon enough to sort that one out. ;)