title: Running magento on other port than default 80
body: <p>I have configured Apache virtual hosting on port 8080 to point to my magento website.     </p>
  
  <pre><code>        Listen 8080
  
          &lt;VirtualHost 6x.2x.6x.1x:8080&gt;
  
      ServerAdmin webmaster@localhost
      ServerName domainname.com
  ServerAlias *.domainname.com
  DocumentRoot /var/www/sites/domain/
  
      &lt;Directory /&gt;
              Options FollowSymLinks
              AllowOverride all
              Order allow,deny
              allow from all
      &lt;/Directory&gt;
  
      ErrorLog /var/log/apache2/error.log
  
      # Possible values include: debug, info, notice, warn, error, crit,
      # alert, emerg.
      LogLevel warn
  
      CustomLog /var/log/apache2/access.log combined
      ServerSignature On
  
  &lt;LocationMatch ".*\svn.*"&gt;
      Order allow,deny
      Deny from all
  &lt;/LocationMatch&gt;
  
             &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>When i go to the website www.domain.com:8080 the js, css, img and other things are not loaded because the port is not attached to the links</p>
  
  <p>Here is a rewrite rule in magento .htaccess that does not seem to work:</p>
  
  <pre><code>         &lt;IfModule mod_rewrite.c&gt;
  
  ############################################
  ## enable rewrites
  
      Options +FollowSymLinks
      RewriteEngine on
  
  ############################################
  ## you can put here your magento root folder
  ## path relative to web root
  
      #RewriteBase /magento/
  
  ############################################
  ## workaround for HTTP authorization
  ## in CGI environment
  
      RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  
  ############################################
  ## always send 404 on missing files in these folders
  
      RewriteCond %{REQUEST_URI} !^/(media|skin|js)/
  
  ############################################
  ## never rewrite for existing files, directories and links
  
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-l
  
  ############################################
  ## rewrite everything else to index.php
      RewriteCond %{SERVER_PORT} !^8080$
      RewriteRule .* http://6x.2x.6x.1x:8080/index.php [L]
  
         &lt;/IfModule&gt;
  </code></pre>
  
  <p>Is Rewrite-mod the right solution to run magento site on different port? If yes, where is my mistake in the current Rewrite rule?</p>
  
  <p>thank you,</p>
  
  <p>Margots</p>