LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-27-2019, 09:16 AM   #1
socalheel
Member
 
Registered: Oct 2012
Location: Raleigh, NC
Distribution: CentOS / RHEL
Posts: 158

Rep: Reputation: 3
Assistance with .htaccess rewrite rule


Hi. I am looking to redirect traffic with a specific subfolder to another domain.

Example: I want https://domainone.com/subfolder/898989 to end up going here: https://domaintwo.com/SUBFOLDER?code=898989

Here is the rule I have, but it's not grabbing the 898989 as I think it should, it's also grabbing the subfolder/898989, which is resulting in https://seconddomain.com/SUBFOLDER?c...bfolder/898989

Oh, and the 898989 is completely arbitrary ... I need it for any number string.

Code:
RewriteEngine On
RewriteCond %{http_host} ^domainone.com$
RewriteCond %{request_uri} ^/vip/(.*)$
RewriteRule (.*) https://domaintwo.com/VIP?code=$1 [R=302,L]
Thank you.

Last edited by socalheel; 03-27-2019 at 09:28 AM.
 
Old 03-27-2019, 09:27 AM   #2
socalheel
Member
 
Registered: Oct 2012
Location: Raleigh, NC
Distribution: CentOS / RHEL
Posts: 158

Original Poster
Rep: Reputation: 3
Never mind ... got it working with this:


Code:
RewriteEngine On
RewriteCond %{http_host} ^domainone.com$
RewriteCond %{request_uri} ^/vip/(.*)$
RewriteRule vip/(.*) https://domaintwo.com/VIP?code=$1 [R=302,L,NC]
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] .htaccess rewrite rule behind aws load balancer socalheel Linux - Server 4 01-16-2015 08:41 PM
htaccess rewrite rule asifbasha Linux - Server 1 09-21-2011 12:48 PM
.htaccess rewrite problem skylimit123 Linux - Server 6 04-02-2010 11:42 AM
htaccess 301 rewrite BillKat Linux - Server 2 04-07-2009 12:54 PM
Apache2 mod vhost_alias - problems with .htaccess mod rewrite d_t_baker Linux - Server 1 08-16-2007 07:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 09:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration