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)
-   -   I have a quick question for programmers or server admins (https://gfy.com/showthread.php?t=1024383)

Persius 05-27-2011 05:39 PM

I have a quick question for programmers or server admins
 
Let say I want to make a rule in htaccess that when a user types mydomain.com/xxxxxxx
it will redirect them to another site otherdomain.com/folder/xxxxxxx/folder...

so basically its taking what they put after the url and inserting it in another url that it will redirect them to.

what's the best way to go about this? thanks in advance :)

woj 05-27-2011 05:45 PM

Mod Rewrite FTW

icq: 33375924 I'll hook it up for you for a few bucks :thumbsup

CYF 05-27-2011 05:52 PM

Redirect /folder http://www.example.com/newfolder

Persius 05-27-2011 05:54 PM

to clarify

the xxxxxxx = different each time (username)

Juicy D. Links 05-27-2011 05:55 PM

kuniiiiiiiiiiiiiiiiiiiiiii

onwebcam 05-27-2011 06:23 PM

301 redirect
http://www.webconfs.com/how-to-redirect-a-webpage.php

VIPimp 05-27-2011 06:35 PM

He's not trying to do a regular redirect... he wants the the id in the url to carry over within the url it will be redirected to.

CYF 05-27-2011 06:43 PM

Quote:

Originally Posted by Persius (Post 18172544)
to clarify

the xxxxxxx = different each time (username)

you'll need some PHP for that.

react 05-27-2011 07:15 PM

Can be done with mod_rewrite exclusively.

fris 05-27-2011 08:18 PM

maybe something like this?

Code:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^([a-z0-9]+)$ http://otherdomain.com/folder/$1/folder [NC,R=301,L]

(removes www from domain, not really needed)

VIPimp 05-27-2011 08:50 PM

Quote:

Originally Posted by fris (Post 18172815)
maybe something like this?

Code:

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^([a-z0-9]+)$ http://otherdomain.com/folder/$1/folder [NC,R=301,L]

(removes www from domain, not really needed)

Thank you Fris, EXACTLY what we were looking for... BUT do you know how we can make it work if the variable also has dashes in it.
This does not work if its something like domain.com/xx-xxxx-xxxxx ...we need it to work in both situations.

Barry-xlovecam 05-27-2011 09:08 PM

Code:

RedirectMatch 301 ^/(.*)$ http://static.askapache.com/$1
http://www.google.com/cse/home?cx=00...%3Akk7rwc2gx0i :)


VIPimp 05-27-2011 09:28 PM

Quote:

Originally Posted by Barry-xlovecam (Post 18172881)
Code:

RedirectMatch 301 ^/(.*)$ http://static.askapache.com/$1

thanks that worked too but it also redirects the typeins to the domain that dont have anything after .com/

I got Fris's code to work by adding a - after the 9 in the rewrite rule... RewriteRule ^([a-z0-9-]+)


do you know what line I should put if I want the regular typeins redirected to a whole other site such as just www.yahoo.com ?

Tempest 05-27-2011 10:55 PM

Quote:

Originally Posted by VIPimp (Post 18172909)
thanks that worked too but it also redirects the typeins to the domain that dont have anything after .com/

I got Fris's code to work by adding a - after the 9 in the rewrite rule... RewriteRule ^([a-z0-9-]+)


do you know what line I should put if I want the regular typeins redirected to a whole other site such as just www.yahoo.com ?

Code:

RedirectMatch 301 ^/*$ http://www.yahoo.com/
RedirectMatch 301 ^/(.*)$ http://static.askapache.com/$1


fris 05-28-2011 03:36 AM

Quote:

Originally Posted by VIPimp (Post 18172909)
thanks that worked too but it also redirects the typeins to the domain that dont have anything after .com/

I got Fris's code to work by adding a - after the 9 in the rewrite rule... RewriteRule ^([a-z0-9-]+)


do you know what line I should put if I want the regular typeins redirected to a whole other site such as just www.yahoo.com ?

how are you detecting typins?


All times are GMT -7. The time now is 08:19 AM.

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