Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 04-26-2018, 07:31 PM   #1
Mr Pheer
Living inside your head.
 
Mr Pheer's Avatar
 
Industry Role:
Join Date: Dec 2002
Location: In your AirBNB
Posts: 20,411
Anybody here know regex and redirect match?

Holy shit it's not a political thread...

Pretend we are working with something like this:
domain.com/montana/milfs-in-bozeman.php
domain.com/montana/bozeman-is-boring.php
domain.com/montana/fuck-bozeman-it-sucks-here.php
domain.com/montana/whatever-bozeman-random-shit.php

And you want to redirect anything in the /montana/ folder that mentions bozeman to a new folder

domain.com/montana/bozeman/index.php

I dont need to match the filename in the new folder, I have plans for something different... just need to match the city and send it to the correct folder. Right now all the cities are just dumped in one folder... thousands of pages actually.

Somebody have a htaccess code for this?
Mr Pheer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2018, 09:33 PM   #2
money biz
Confirmed User
 
Join Date: Jan 2003
Posts: 951
Not sure what you mean but I generate those types of pages and redirect using a cloaker
money biz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2018, 10:15 PM   #3
Mr Pheer
Living inside your head.
 
Mr Pheer's Avatar
 
Industry Role:
Join Date: Dec 2002
Location: In your AirBNB
Posts: 20,411
Quote:
Originally Posted by money biz View Post
Not sure what you mean but I generate those types of pages and redirect using a cloaker
Generating pages is easy and only takes seconds. Doing mass 301 redirects for pages that already have listings while maintaining SEO the correct way is more challenging.
Mr Pheer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2018, 11:38 PM   #4
money biz
Confirmed User
 
Join Date: Jan 2003
Posts: 951
Only way I know is to import your pages into wordpress and use a cloaker plugin. Then redirect off keywords/searches anywhere you want.
money biz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-26-2018, 11:50 PM   #5
Mr Pheer
Living inside your head.
 
Mr Pheer's Avatar
 
Industry Role:
Join Date: Dec 2002
Location: In your AirBNB
Posts: 20,411
Quote:
Originally Posted by money biz View Post
Only way I know is to import your pages into wordpress and use a cloaker plugin. Then redirect off keywords/searches anywhere you want.
Wordpress?

OMG no...
Mr Pheer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-27-2018, 12:14 AM   #6
WiredGuy
Pounding Googlebot
 
Industry Role:
Join Date: Aug 2002
Location: Canada
Posts: 34,451
It's been a while since doing htaccess redirects, but you should be able to do a conditional match with regexp to match #domain.com/(.*?)/(.*?)bozeman(.*?)#

WG
__________________
I play with Google.

Last edited by WiredGuy; 04-27-2018 at 12:17 AM.. Reason: updated string
WiredGuy is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-27-2018, 12:31 AM   #7
Mr Pheer
Living inside your head.
 
Mr Pheer's Avatar
 
Industry Role:
Join Date: Dec 2002
Location: In your AirBNB
Posts: 20,411
Quote:
Originally Posted by WiredGuy View Post
It's been a while since doing htaccess redirects, but you should be able to do a conditional match with regexp to match #domain.com/(.*?)/(.*?)bozeman(.*?)#

WG
Could you please type the whole thing?

I can figure it out but it's like missing three digits of a phone number
Mr Pheer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-27-2018, 12:45 AM   #8
Bladewire
StraightBro
 
Bladewire's Avatar
 
Industry Role:
Join Date: Aug 2003
Location: Monarch Beach, CA USA
Posts: 56,232
You sneaky sneaky little mynx you
Bladewire is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-27-2018, 01:49 AM   #9
EddyTheDog
Just Doing My Own Thing
 
EddyTheDog's Avatar
 
Industry Role:
Join Date: Jan 2011
Location: London, Spain, New Zealand, GFY - Not Croydon...
Posts: 25,034
Just the word 'regex' makes my head hurt - The guy that invented it must still laugh when he sees geeks tearing what little hair they have left out...
__________________
-

Chaturbate Script - https://gfy.com/fucking-around-and-b...er-issues.html - Now supports White Labels
EddyTheDog is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-27-2018, 07:53 AM   #10
blackmonsters
Making PHP work
 
blackmonsters's Avatar
 
Industry Role:
Join Date: Nov 2002
Location: 🌎🌅🌈🌇
Posts: 20,227
[The correct answer has been blocked because Blackmonsters is on your shit list.]
__________________
Make Money with Porn
blackmonsters is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-27-2018, 09:10 AM   #11
Cyber Fucker
Hmm
 
Cyber Fucker's Avatar
 
Industry Role:
Join Date: Sep 2005
Location: On an endless road around the world for rock and roll.
Posts: 12,642
There are many ways to achive that, one would be to place local .htaccess to /montana/ directory with the following lines:

Code:
<IfModule mod_rewrite.c>
RewriteEngine  on
RewriteCond %{REQUEST_URI} ^.*(bozeman).*$
RewriteRule ^ /montana/bozeman/index.php [L,R=302,NE]
</IfModule>
__________________
Cyber Fucker is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-27-2018, 03:35 PM   #12
Mr Pheer
Living inside your head.
 
Mr Pheer's Avatar
 
Industry Role:
Join Date: Dec 2002
Location: In your AirBNB
Posts: 20,411
Quote:
Originally Posted by blackmonsters View Post
[The correct answer has been blocked because Blackmonsters is on your shit list.]
Since when?
Mr Pheer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-27-2018, 03:57 PM   #13
Mr Pheer
Living inside your head.
 
Mr Pheer's Avatar
 
Industry Role:
Join Date: Dec 2002
Location: In your AirBNB
Posts: 20,411
Quote:
Originally Posted by Cyber Fucker View Post
There are many ways to achive that, one would be to place local .htaccess to /montana/ directory with the following lines:

Code:
<IfModule mod_rewrite.c>
RewriteEngine  on
RewriteCond %{REQUEST_URI} ^.*(bozeman).*$
RewriteRule ^ /montana/bozeman/index.php [L,R=302,NE]
</IfModule>
This almost works but it gives me some weird redirect loop
Mr Pheer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-27-2018, 05:03 PM   #14
Mr Pheer
Living inside your head.
 
Mr Pheer's Avatar
 
Industry Role:
Join Date: Dec 2002
Location: In your AirBNB
Posts: 20,411
I'm just deleting it and rebuilding it. Spent too much time on it already, and google will respider the whole thing in a couple of days. No big deal.
Mr Pheer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-27-2018, 05:06 PM   #15
Cyber Fucker
Hmm
 
Cyber Fucker's Avatar
 
Industry Role:
Join Date: Sep 2005
Location: On an endless road around the world for rock and roll.
Posts: 12,642
Quote:
Originally Posted by Mr Pheer View Post
This almost works but it gives me some weird redirect loop
Yup, could be, cause the url redirected to also contains the "bozeman" keyword.

So, you can add some condition before to ignore the url you are redirecting to for example:


Code:
<IfModule mod_rewrite.c>
RewriteEngine  on
RewriteCond %{REQUEST_URI} !^.*(\/montana\/bozeman\/index.php)$
RewriteCond %{REQUEST_URI} ^.*(bozeman).*$
RewriteRule ^ /montana/bozeman/index.php [L,R=302,NE]
</IfModule>
__________________
Cyber Fucker is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-27-2018, 08:25 PM   #16
Mr Pheer
Living inside your head.
 
Mr Pheer's Avatar
 
Industry Role:
Join Date: Dec 2002
Location: In your AirBNB
Posts: 20,411
Quote:
Originally Posted by Cyber Fucker View Post
Yup, could be, cause the url redirected to also contains the "bozeman" keyword.

So, you can add some condition before to ignore the url you are redirecting to for example:


Code:
<IfModule mod_rewrite.c>
RewriteEngine  on
RewriteCond %{REQUEST_URI} !^.*(\/montana\/bozeman\/index.php)$
RewriteCond %{REQUEST_URI} ^.*(bozeman).*$
RewriteRule ^ /montana/bozeman/index.php [L,R=302,NE]
</IfModule>
Thanks, I will try this out and let you know if it works. Luckily I got distracted earlier and havent deleted it yet
Mr Pheer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 04-27-2018, 09:19 PM   #17
Mr Pheer
Living inside your head.
 
Mr Pheer's Avatar
 
Industry Role:
Join Date: Dec 2002
Location: In your AirBNB
Posts: 20,411
That worked great

Thanks, Cyber Fucker!
Mr Pheer is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks

Tags
folder, match, redirect, city, filename, send, plans, pages, code, htaccess, thousands, correct, cities, dumped, /montana, thread, political, pretend, regex, holy, shit, mentions, bozeman



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.