Coder fags, I need your help

Coder fags, I need your help.

I'm migrating an old site to a new site and I want to redirect the oldsite.com homepage to newsite.com homepage. This is easy normally, but I also want to redirect oldsite.com/example to newsite.com/product/example. So basically I only want oldsite.com or www.oldsite.com to redirect to newsite.com, and not have the hompage url redirect to the newsite.com/product/ part. my htaccess is set up like this:

RewriteEngine On

RewriteBase /
RewriteCond %{HTTP_HOST} ^oldsite\.com$ [NC]
RewriteRule ^(.*)$ newsite.com/s=$1&post_type=product [R=301,L]

RewriteBase /
RewriteCond %{HTTP_HOST} ^www.oldsite\.com$ [NC]
RewriteRule ^(.*)$ newsite.com/s=$1&post_type=product [R=301,L]

So pretty much anything on "oldsite.com/anything" redirects to "newsite.com/s=anything&post_type=product" I want this, but I also want oldsite.com to redirect to newsite.com and not newsite.com/s=&post_type=product How can I set this up?

Dumping my asian folder for help.

Thanks plebs.

Other urls found in this thread:

newsite.com
newsite.com/s=$1&post_type=product
newsite.com/s=$1
twitter.com/AnonBabble

...

...

...

...

...

Got a mega folder?

Shutup faggot and enjoy the asians

...

...

do you want help or not, retard?

...

...

...

...

...

more asian girls plz

...

my favy plz help wit da kode

...

...

...

you could have at least cross posted on you dumb nigger.
>b-but Sup Forums is only board I know durrrr

...

Sorry never done any web programming

>double chest zipper
Someone has thought of that. Cheers to them.

Change the regex to something a little more substantial, like
^/(.+)$
and add another rewrite rule for
^/?$
for the main page.

...

Can you elaborate a little more? maybe with an example?

RewriteCond %{HTTP_HOST} ^(www\.)?oldsite\.com$ [NC]
RewriteRule ^(/)?$ newsite.com [R=301,L]

RewriteCond %{HTTP_HOST} ^(www\.)?oldsite\.com$ [NC]
RewriteRule ^(.*)$ newsite.com/s=$1&post_type=product [R=301,L]

...

My rewrite-fu is old and weak but it looks like someone else did that for me.

This worked. Thank you you glorious bastard. Heres some more asians for you.

RewriteEngine On
RewriteCond %{HTTP_HOST} ^oldsite.com$ [NC]
RewriteRule ^(.*)$ newsite.com/s=$1 [L,R=301]

i didnt help but im lurking

...

problem solved. Still will dump for awhile.

Any of these chicks got vids?

No worries man. I've been doing this shit for so long, it barely requires thinking anymore. Glad it worked for you.

...

...

...

...

...

Bump

dat pussy hair

Who are you hosting on. If amazon then you could just use the Route 53 and route the old site to the new site. If not on amazon just change host.

I haven't used mod_rewrite since like 2008. Every app I write these days just uses the routing modules built into the tech stack

Also is this client work? You should brush up on your regexes then dude, you're gonna need it again in the future.

Since uve been doing this for a while can u give me tips on where to get started to learn web programming?

I suspect this is just the leaving-behind-a-stub portion of the program.
>also router masterrace

The web, of course. Set up a web server on your machine. Read everything you can get your hands on. Above all, experiment, and expect to spend a good few hundred hours gittin gud.

Mo

I mean, obviously the web but I wanted to know maybe certain website or even book I can read to as a noob

wc3schools.com

lol

developer.mozilla.com is alright for the frontend part of it and has a few tutorials. Backend stuff, pretty much just read the docs front to back and experiment. Search engines are your friend because there are a hundred ways to do some things and each has their tradeoffs.

...