Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I know tittle is horrible, but couldn't find a way to explain it in few words.

My problem is following...

Server domain is -

username.dyndns.org:9999

I setup subdomain with CNAME on my hosting server.

trac.mydomain.com -> username.dyndns.org
svn.mydomain.com -> username.dyndns.org

So trac/svn url is:

trac.mydomain.com:9999/trac
svn.mydomain.com:9999/svn/repos

I want to shorten urls to just svn.mydomain.com:9999 and trac.mydomain.com:9999

How do I do this? what are my options?

(unfortunately I was told it is not possible to put path in CNAME, otherwise I would just make trac.mydomain.com point to username.dyndns.org:9999/trac)

1 define way I could think of myself is using virtual hosts and just using different port for svn and trac. But I wonder if there are more solutions.

share|improve this question

2 Answers 2

up vote 2 down vote accepted

Updated (after reading the question more carefully)

In your httpd.conf file...

...make sure a line similar to the following appears (note, if you've got one of the newer Linux distros they do a crazy/half-braindead directory linking scheme to enable and disable modules, you'll have to consult the documentation for your distro if that's the case).

LoadModule rewrite_module   libexec/apache22/mod_rewrite.so

...then, somewhere later in the file, you should have some sort of organization/structure where you group similar directives together, put lines similar to this:

<IfModule rewrite_module>
    RewriteEngine on

    RewriteCond %{HTTP_HOST} trac.example.com
    RewriteRule (.*) /trac$1

    RewriteCond %{HTTP_HOST} svn.example.com
    RewriteRule (.*) /svn/repos$1
</IfModule>

Note

If you have anything else on the Apache server you haven't mentioned, this will likely break that.

share|improve this answer
    
cant I just do RewriteRule on trac.mydomain.com:8891 -> /trac/ svn.mydomain.com:8891 -> /svn/repos/ but only if user arrives through subdomain? –  Sandro Dzneladze May 11 '12 at 13:22
    
Updated... Sorry, didn't read the question close enough. –  Chris S May 11 '12 at 13:56
    
1. this will only make sense if the OP is not using vhosts. 2. the OP should use vhosts, and set the documentroot properly. All these rewrites are unnecessary. –  adaptr May 11 '12 at 13:59
    
@adaptr 1. He's made no indication that he is using vhosts, I'm not responsible for giving an incorrect answer if the information provided is incorrect. 2. Write your own answer. –  Chris S May 11 '12 at 14:12
    
Due to reasons I don't want to disclose I cannot use nhosts, mod_rewrite solution is perfect for me. –  Sandro Dzneladze May 11 '12 at 14:33

You can create two virtual host (and it is possible to use the same port) in combination with mod_rewrite.

share|improve this answer
    
can you give me precise pointers? thanks! –  Sandro Dzneladze May 11 '12 at 12:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.