LinuxQuestions.org
Review your favorite Linux distribution.
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 11-21-2013, 02:01 PM   #1
sir-lancealot
Member
 
Registered: Aug 2007
Posts: 346

Rep: Reputation: 31
mod_rewrite help with folder redirection


I have a new short URL registered for some ease and just having some issues as folders are involved, so looking for the re-write guru to help out in 2 lines making me feel less like a linux guy

So I have mylongdomain.com and tiny.wf (yes .wf is the suffix). So I have;

Code:
[RewriteCond %{HTTP_HOST} tiny\.wf [NC]
RewriteRule ^(.*)$ http://www.mylongdomain.com/$1 [L,R=301]
Works perfect. But I have 2 more rules.
I want tiny.wf/s/* to goto mylongdomain.com/folder1/?id=*

and something similar. But I am trying;
Code:
RewriteCond %{HTTP_HOST} ^tiny\.wf$ [NC]
RewriteRule ^/s(.*)$ http://www.mylongdomain.com/folder1/?id=$1 [R,NC,L]
but it's not working. I'm sure it's something simple I am missing, but I am reading, testing and figured I would get a quick backhand here quicker.

Thanks
 
Old 11-21-2013, 04:09 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653Reputation: 653
Maybe:
Code:
RewriteCond %{HTTP_HOST} ^tiny\.wf$ [NC]
RewriteRule ^/s/(.*)$ http://www.mylongdomain.com/folder1/?id=$1 [R,NC,L]
This stuff is not the easiest to do blind .. seeing the logs really helps, are you logging rewrites to a separate log?

Last edited by kbp; 11-21-2013 at 04:10 PM.
 
Old 11-22-2013, 09:28 AM   #3
sir-lancealot
Member
 
Registered: Aug 2007
Posts: 346

Original Poster
Rep: Reputation: 31
Thanks. I did get it working, funny thing I was doing it in an .htaccess and since there was no /s folder, I was getting a 404 not realizing, so moved it into the vhost config and all worked.

Thanks again.
 
  


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
LXer: Subdomain Redirection Using htaccess And mod_rewrite On Apache For Linux Or Uni LXer Syndicated Linux News 0 02-27-2009 09:00 AM
Linux Samba Server Folder Redirection jedilost1 Linux - Newbie 2 10-21-2008 11:42 AM
Samba Server Folder Redirection jedilost1 Linux - Server 2 10-19-2008 05:30 AM
Samba Ldap Roaming Profiles + Folder Redirection lramos85 Linux - Networking 1 11-17-2006 01:52 PM
mod_rewrite url redirection sqn Linux - Software 2 10-04-2006 08:39 AM

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

All times are GMT -5. The time now is 03:05 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