LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 06-17-2005, 04:52 AM   #1
verbatim
Member
 
Registered: Apr 2005
Posts: 31

Rep: Reputation: 15
htaccess rewriteEngine - which variable is wrong?


i am trying to configure a rewrite rule that will redirect foo.bar.com to
www.bar.com/okay/foo

i have attempted to alter the script below with no luck.

Code:
############################ 
rewriteEngine On 
# Rewrite <subdomain>.example.com/<path> to example.com/<subdomain>/<path> 
# 
# Skip rewrite if no hostname or if subdomain is www 
RewriteCond %{HTTP_HOST} . 
RewriteCond %{HTTP_HOST} !^www\. [NC] 
# Extract (required) subdomain (%1), and first path element (%3), discard port number if present (%2) 
RewriteCond %{HTTP_HOST}<>%{REQUEST_URI} ^([^.]+)\.mysite\.com(:80)?<>/([^/]*) [NC] 
# Rewrite only when subdomain not equal to first path element (prevents mod_rewrite recursion) 
RewriteCond %1<>%3 !^(.*)<>\1$ [NC] 
# Rewrite to /subdomain/path 
RewriteRule ^(.*) /%1/$1 [L]
can anyone help me please???

Thanks in advance

Last edited by verbatim; 06-18-2005 at 06:05 PM.
 
Old 06-17-2005, 06:25 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
try :
Code:
rewriteEngine On 
rewriteCond %{HTTP_HOST} ^foo\.bar\.com
rewriteRule (.*) /okay/foo [L]
Assuming the virtual host/http host is www.bar.com
 
  


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
bash, how to get variable name from variable Duudson Programming 6 01-06-2005 04:38 PM
calling a variable within a variable sdandeker Programming 9 04-28-2004 03:55 PM
How to get 'Window' variable from a 'Widget' variable bordel Programming 0 11-19-2003 03:19 AM
Apache RewriteEngine ApacheMan252 Linux - Software 10 09-04-2003 01:43 AM
RewriteEngine andy18 Linux - General 1 03-31-2003 12:59 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:49 PM.

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