Need help understanding mod_rewrite and redirect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We have a website that has been in use for a project for years, which someone else took up and would like the site permanently redirected to the new URL.  For whatever reason I cannot get this redirect to work consistently, and I'd like to know where I'm going wrong.

The only thing I changed on the website.conf file was adding the redirect statement.  What used to happen was if you came in on the full base URL, it would append the directory to the URL and load the site.  

Now it alternates between showing the /var/www/index file or redirecting to the new website, and I'm not sure why.

website.conf:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^full.website.base.URL$ [NC]
RewriteRule ^/$ https://full.website.base.URL/url-path/ [L,R]
alias /url-path "/local/www/path"
<Directory "/local/www/path">
Require all granted
RewriteEngine on
RewriteBase /url-path
Redirect permanent https://new.website.base.url/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
        RewriteCond %{HTTP_HOST} !full.website.base.URL
        RewriteRule ^.*$ https://full.website.base.URL%{REQUEST_URI} [R]
        <Files "cron.php">
               RewriteCond %{REQUEST_URI}      /url-path/cron.php$ [NC]
               RewriteRule "^/url-path/cron.php$"  http://full.website.base.URL%{REQUEST_URI} [L]
        </Files>
</Directory>


and for good measure, I put .htaccess in the local www path:
RewriteEngine On
Redirect permanent https://new.website.base.url/



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux