GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Quick .htaccess redirect question (https://gfy.com/showthread.php?t=1118988)

nexcom28 08-21-2013 12:41 PM

Quick .htaccess redirect question
 
How do you redirect for example:

domain.com/fat-boy/wicked

to

anotherurl.com/fat-boy-paradise

Using .htaccess with the rediect happening after 10 seconds

Thanks

paffie 08-21-2013 01:03 PM

i don't think you have a delay-option in htaccess... I'm not a guru, but i've never heared from such a thing...

Maybe you could use your html-headers for this:
<meta http-equiv="refresh" content="10; url=http://example.com/">
This way, you can show your original page, and it will automatically foreward after 10 seconds

or place a code like this in your php-code:
<?php
sleep(10);
header('Location: http://www.example.com/');
?>
This second option (including in php) might need some tweaking, since it's possible the header has to be sent before any other data is sent to the browser... (actually, i'm pretty sure of this)

nexcom28 08-21-2013 01:10 PM

Yeah the problem is I just want to redirect selected pages of a wordpress blog to an external url.
I did think about meta redirects but this would affect it sitewide wouldn't it.

If I went down the .php could I just not call the php from anywhere within the page or does it need to be in the header.

I'm sure there must be an easier way, a plugin or something.

Barry-xlovecam 08-21-2013 01:19 PM

Code:

Redirect permanent /path http://man-in-the-middle.com/meta-refresh-redirector-page.html?1
man-in-the-middle.com/meta-refresh-redirector-page has the 10 seconds delay. (Or, use a JavaScript on the wordpress pages only redirecting for that referring page ...)

https://www.google.com/search?client...+page+redirect

nexcom28 08-21-2013 01:23 PM

Thanks I found a plugin after all Quick Page/Post Redirect Plugin
Seems to do the job.

livexxx 08-21-2013 03:42 PM

You need instant 301's and work on the canonical redirects as well. Is it for google or surfers?

AndrewX 08-21-2013 04:12 PM

RewriteEngine on
RedirectMatch /(.*)$ http://www.newdomain.com

Just did this for a client. :2 cents:

Edit: Oh I missed that 10 sec comment

lucas131 08-21-2013 05:07 PM

Quote:

Originally Posted by nexcom28 (Post 19767824)
Thanks I found a plugin after all Quick Page/Post Redirect Plugin
Seems to do the job.

yes happy you :)

paffie 08-22-2013 01:11 AM

Quote:

Originally Posted by nexcom28 (Post 19767799)
If I went down the .php could I just not call the php from anywhere within the page or does it need to be in the header.

I'm happy the plugin works for you :-)
In case anybody ever finds this post, and wants to use php instead of a plugin, the anser to your question is: the header location has to be set before any other data is sent to the users browser (if i remember correctly)...
In other words, you can actually make a database-query, use classes and functions,... and depending on the outcome of your querys and calculations print the "header('location" or not. As long as nothing is sent to the browser during the execution of your code.... So it wouldn't be wise to use this line in the <body>-section ;-)

HomerSimpson 08-22-2013 01:33 AM

Quote:

Originally Posted by AndrewX (Post 19768095)
RewriteEngine on
RedirectMatch /(.*)$ http://www.newdomain.com

Just did this for a client. :2 cents:

Edit: Oh I missed that 10 sec comment

don't forget to add [r=301]


All times are GMT -7. The time now is 10:43 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123