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)
-   -   ANy programmers here know how to do an if/else?? (https://gfy.com/showthread.php?t=635333)

clickhappy 07-19-2006 09:40 PM

ANy programmers here know how to do an if/else??
 
I just need something that says if /2/ appears in a url, then change it to /3/.
I want it to go to a different folder.
Anyone know how to do this with php, or javascript?
is that going to slow down the page a lot?

BigBen 07-19-2006 10:00 PM

May want to use mod_rewrite.

Sly 07-19-2006 10:01 PM

I haven't done much programming in a long time and I wasn't the best, but I think for something like that you would be much better off using regular expressions, not if/else.

woj 07-19-2006 10:03 PM

Quote:

Originally Posted by BigBen
May want to use mod_rewrite.

:thumbsup

Nookster 07-19-2006 10:06 PM

Need to use mod_rewrite for that one.

SmokeyTheBear 07-19-2006 10:19 PM

<?php

$this = $PHP_SELF;
if (preg_match("/\/2\//", $this)) {
echo "folder found";
}
else {
echo "folder not found";
}
?>

if the folder name your looking for is 2 like

www.yoursite.com/nastylady/2/something.html

SmokeyTheBear 07-19-2006 10:24 PM

whoops i think i misunderstood your question actually. you want to rewrite all urls on the page or if the php itself is in a folder called /2/ ?

madawgz 07-19-2006 10:53 PM

Quote:

Originally Posted by SmokeyTheBear
<?php

$this = $PHP_SELF;
if (preg_match("/\/2\//", $this)) {
echo "folder found";
}
else {
echo "folder not found";
}
?>

if the folder name your looking for is 2 like

www.yoursite.com/nastylady/2/something.html

something else to learn :thumbsup

clickhappy 07-19-2006 11:07 PM

Quote:

Originally Posted by SmokeyTheBear
whoops i think i misunderstood your question actually. you want to rewrite all urls on the page or if the php itself is in a folder called /2/ ?

no
when the url says http://www.whatever.com/porn/2/
I want to rewerite it to say http://www.whatever.com/porn/3/ automatically because there are a ton of links

adultseo 07-19-2006 11:19 PM

  • is the /porn/ directory a real directory?
  • is /porn/ the only directory in wich you need /2/ rewritten to /3/?
  • would you like to use Mod rewrite to simulate as if /2/ is /3/, so it will look to the browser as if you are on /2/ but you see /3/, or do you want to have a redirect in wich I would advice to use a 301 redirect so that the possibly indexed /2/ directory it's PR (SE value) is transfered to /3/

Let me know ;)

Best Regards,
Adult SEO

BigBen 07-19-2006 11:40 PM

Drop this in your .htaccess in the /porn/ directory for a redirect...

RewriteEngine On
RewriteRule ^2/$ /porn/3/ [R]

adultseo 07-19-2006 11:49 PM

In that case better use:
Code:

RewriteEngine on
rewriterule ^2/$ http://www.domain.com/ [r=301,L]
rewriterule ^2/(.*)$ http://www.domain.com/$1 [r=301,L]

This is better for SEO in case your old /2/ directory has been indexed.

Kimo 07-19-2006 11:55 PM

php sucks inrl


All times are GMT -7. The time now is 10:49 AM.

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