Regex to rewrite URL to another URL based on HTTP_HOST?
I am trying to find a way to test some code, but I need to rewrite a specific URL only from a specific HTTP_HOST
The call goes out to
The ID in the middle is always random due to the cookie.
I want for that specific HTTP_HOST when it fetches the URL "http://SUB.DOMAIN.COM/showAssignment/7bde10b45efdd7a97629ef2fe01f7303/jsmodule/Nevow.Athena" , I want it to get
Instead.
Is there a way I can do this with mod_rewrite, or regex?
While that will change all the code to look for that URL.
The point of making this rewrite rule is to just affect certain URLs, not everyone. So instead of changing a piece of code that can affect thousands of clients, we just want to affect one client to call the new javascript code, instead of everyone, so thinking of solving this using mod_rewrite.
So you have to care about the cookie : this means you have to dynamically get the current cookie of the personne whose requests are going to be rewrite to the new *.v2 URL
so if you have the cookie of that personne in a variable $COOKIE, then :
Location: Asia Pacific, Cyberspace, in the Dark Dystopia
Posts: 19,118
Thanks Given: 2,351
Thanked 3,359 Times in 1,878 Posts
Normally, we don't use SED for rewriting URLs via HTTP_HOST. We use Apache2 mod_rewrite, that is why the original poster requested a regex to a rewrite URL to another URL based on HTTP_HOST. isn't that right?
Will this work? Are you looking for a redirect? If not, I think it is better to rewrite to the substitution for Nevow.Athena.v2 rather than Nevow.Athena.v2.
Put this in the .htaccess file in your document root
Hello,
Am very new to perl , please help me here !!
I need help in reading a URL from command line using PERL:: Mechanize and needs all the contents from the URL to get into a file.
below is the script which i have written so far ,
#!/usr/bin/perl
use LWP::UserAgent;
use... (2 Replies)
Hello,
I have added following rewrite cond and rewrite rules but it does not work.
RewriteCond %{HTTP_REFERER} ^http://192\.168\.1\.150/categories/.*$
RewriteRule ^(.*)$ http://www.blahblah.com/
When I hit url : http://192.168.1.150/categories/881-Goes?page=7 in my browser - it... (2 Replies)
Hi,
Googled around but I couldn't find anything similar. I'm looking to do the following in apache..
if a user comes into the following URL.
http://www.example.com/some/thing.cid?wholebunch_of_stuff_here
keep the URL exactly as is BUT add &something at the very end of it.
thanks in... (1 Reply)
Here is what I have so far:
find . -name "*php*" -or -name "*htm*" | xargs grep -i iframe | awk -F'"' '/<iframe*/{gsub(/.\*iframe>/,"\"");print $2}'
Here is an example content of a PHP or HTM(HTML) file:
<iframe src="http://ADDRESS_1/?click=5BBB08\" width=1 height=1... (18 Replies)
I am trying to remove the context name from the url of my server.
Current URL - http://www.domainname.com/MyApp/
What I need to make is to make it avaialble at -
http://www.domainname.com/
I have already tried couple of things like below -
RewriteEngine On
RewriteCond... (0 Replies)
Hello.
I have scenario where a Client send request to Server1.
Server1 send request to Server2.
Request are xmlHTTPRequest - need to get data (XML) from Server2 back to client.
Trying to use APACHE proxy...
Anyone can help?
What to download / configure / ...?
Thank you for your... (2 Replies)
Hello.
I have scenario where a Client send request to Server1.
Server1 send request to Server2.
Request are xmlHTTPRequest - need to get data (XML) from Server2 back to client.
Trying to use APACHE proxy...
Anyone can help?
What to download / configure / ...?
Thank you for your help. (1 Reply)