mod_rewrite from port 80 to 443

Discussion in 'Server Operation' started by gabrix, Oct 15, 2006.

  1. gabrix

    gabrix New Member

    Never had problems with mod rewrite i suppose i'm using same rewrite rules i used in the passed apache2.conf .I don't want users forced to write https:// to reach tor website .Rewrite rules are in the virual host apache2.conf file bit :
         ServerAdmin [email protected]
         DocumentRoot /var/www/fuck
         ErrorLog /var/log/apache2/tor_error.log
         TransferLog /var/log/apache2/tor_access.log
         SSLEngine on
         SSLCertificateFile /etc/apache2/ssl/tor.crt
         SSLCertificateKeyFile /etc/apache2/ssl/tor.key
         RewriteEngine On
         Options +FollowSymlinks
         RewriteCond   %{SERVER_PORT}  !^443$
         RewriteRule ^/(.*) https://%{}/$1 [NC,R,L]
         RewriteCond %{REQUEST_METHOD} ^(TRACE|TRACK)
         RewriteRule .* - [F]
    I'm sort of trying commenting out alterantively the rules you see or adding others i find in the net with different details to make it work.i have also wrote it in the .htaccess file and made a rewrite.conf file 'included'.You can try yourself & HTTP url will answer with an another website i have on port 80 and calls for don't get redirected on port 443 .I'm not into regex but is necessary to use that RewriteRule .* - [F] it's there for deleting isn't it?what's its right position?Is it necessary?
    Thanks !
    Last edited: Oct 15, 2006
  2. Megrain

    Megrain New Member

    Load Module required

    Hi gabrix
    add this line to your httpd.conf

    LoadModule rewrite_module /usr/lib/apache2/
  3. gabrix

    gabrix New Member

    My fault .i have not mension apache version ( 2.0 ) and my OS (debian sarge 3.1 kernel 2.6),sorry !
    I'm not sure you know what you are saying an httpd.conf file for apache2 and a directive for apache used for apache2 ....
    Last edited: Oct 15, 2006
  4. Megrain

    Megrain New Member

    Then Double Check Apache Config File.

    Hi gabrix.
    I don't know Dabian that well.
    but if your rewrite rules don't work check if the module is loaded.
    I used Suse 10 for my setup.
    I also see that you are using Joomla,Mambo for the websites, that's why you need the rewriteengine on.Right?

    Remove the rewrite commands from your vhost file and add it into the htaccess file in the directory of your website.
    You can check if the rewrite module is loaded in joomla's System Info under the System tab in the backend.
    This should be there.
    Loaded Modules 	core prefork http_core mod_so mod_access mod_auth mod_auth_anon mod_auth_dbm mod_auth_digest mod_include mod_log_config mod_env mod_mime_magic mod_cern_meta mod_expires mod_deflate mod_headers mod_usertrack mod_setenvif mod_mime mod_dav mod_status mod_autoindex mod_asis mod_info mod_dav_fs mod_vhost_alias mod_negotiation mod_dir mod_imap mod_actions mod_speling mod_userdir mod_alias mod_rewrite mod_proxy proxy_ftp proxy_http proxy_connect mod_cache mod_suexec mod_disk_cache mod_file_cache mod_mem_cache mod_cgi sapi_apache2 mod_ssl
  5. gabrix

    gabrix New Member

    I't's all right ,that's how we do in debian:
    apache2 enable module rewrite.
    You are saying i better use the htaccess.txt in the joomla documents root dir.I'll give it a try!
  6. gabrix

    gabrix New Member

    I't's all right ,that's the debian way:
    You are saying i better use the htaccess.txt in the joomla documents root dir.I'll give it a try!

Share This Page