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 ^(.*)$ https://www.newsite.com/s=$1&post_type=product [R=301,L]
RewriteBase /
RewriteCond %{HTTP_HOST} ^www.oldsite\.com$ [NC]
RewriteRule ^(.*)$ https://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.
Got a mega folder?
>>745030648
Shutup faggot and enjoy the asians
>>745030721
do you want help or not, retard?
more asian girls plz
my favy plz help wit da kode
>>745031069
you could have at least cross posted on >>>/g/, you dumb nigger.
>b-but /b/ is only board I know durrrr
>>745030594
Sorry never done any web programming
>>745030997
>double chest zipper
Someone has thought of that. Cheers to them.
>>745030594
Change the regex to something a little more substantial, like
^/(.+)$
and add another rewrite rule for
^/?$
for the main page.
>>745031218
Can you elaborate a little more? maybe with an example?
RewriteCond %{HTTP_HOST} ^(www\.)?oldsite\.com$ [NC]
RewriteRule ^(/)?$ https://newsite.com [R=301,L]
RewriteCond %{HTTP_HOST} ^(www\.)?oldsite\.com$ [NC]
RewriteRule ^(.*)$ https://newsite.com/s=$1&post_type=product [R=301,L]
>>745031363
My rewrite-fu is old and weak but it looks like someone else did that for me.
>>745031385
This worked. Thank you you glorious bastard. Heres some more asians for you.
>>745030594
RewriteEngine On
RewriteCond %{HTTP_HOST} ^oldsite.com$ [NC]
RewriteRule ^(.*)$ https://newsite.com/s=$1 [L,R=301]
>>745031613
i didnt help but im lurking
problem solved. Still will dump for awhile.
Any of these chicks got vids?
>>745031613
No worries man. I've been doing this shit for so long, it barely requires thinking anymore. Glad it worked for you.
Bump
>>745033211
dat pussy hair
>>745030594
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.
>>745031958
Since uve been doing this for a while can u give me tips on where to get started to learn web programming?
>>745033505
I suspect this is just the leaving-behind-a-stub portion of the program.
>also router masterrace
>>745034040
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
>>745034224
I mean, obviously the web but I wanted to know maybe certain website or even book I can read to as a noob
>>745034412
wc3schools.com
>>745034412
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.