.htaccess redirection fail |
.htaccess redirection fail |
rpizw |
Mar 5 2020, 08:11 AM
Post
#1
|
Group: Members Posts: 2 Joined: 5-March 20 Member No.: 27,218 |
Hi all,
I'm trying to redirect two simple websites and it just doesn't work! I tried for two days and search so much but nothing I created .htaccess in /var/www/html/ with the following RewriteCond %{HTTP_HOST} ^firstexample.com$ [OR] RewriteCond %{HTTP_HOST} ^www.firstexample.com$ RewriteRule ^(.*)$ http://www.firstexample.com/drupal/$1 [R=301,L] RewriteCond %{HTTP_HOST} ^secondexample.com$ [OR] RewriteCond %{HTTP_HOST} ^www.secondexample.com$ RewriteRule ^(.*)$ http://www.secondexample.com/oldwebsite/$1 [R=301,L] the first time is working but not the second anyone? Thanks in advance. |
pandy |
Mar 5 2020, 08:46 AM
Post
#2
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
I'm actually not sure if it's necessary, but do you have 'RewriteEngine on' on top of that?
QUOTE the first time is working but not the second Do you mean firstexample works but not secondexample? Or do you mean it works the first time you go to that URL but not the second? |
rpizw |
Mar 5 2020, 09:23 AM
Post
#3
|
Group: Members Posts: 2 Joined: 5-March 20 Member No.: 27,218 |
sorry about not being clear.
firstexample website work perfectly second example website never worked. i just see loops in the URL or when I try other things I only get into the root folder from my browser So just so I can be clear as possible, below is how I configured it ---> noticed that I removed the "secondexample" website just because it cause some crushes on my server for some reason.. from /etc/apache2/sites-available/000-default.conf CODE <VirtualHost *:80> ServerAdmin webmaster@localhost DocumentRoot /var/www/html/ ErrorLog ${APACHE_LOG_DIR}/error.log CustomLog ${APACHE_LOG_DIR}/access.log combined RewriteEngine on RewriteCond %{SERVER_NAME} =firstexample.com RewriteRule ^ https://%{SERVER_NAME}%{REQUEST_URI} [END,NE,R=permanent] </VirtualHost> <Directory /var/www/html/> Options Indexes FollowSymLinks MultiViews AllowOverride All Order allow,deny allow from all </Directory> --- From /vart/www/html/.htaccess (which I created) CODE Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^firstexample.com$ [OR] RewriteCond %{HTTP_HOST} ^www.firstexample.com$ RewriteRule ^(.*)$ http://firstexample.com/drupal/$1 [R=301,L] |
pandy |
Mar 5 2020, 09:01 PM
Post
#4
|
🌟Computer says no🌟 Group: WDG Moderators Posts: 20,730 Joined: 9-August 06 Member No.: 6 |
|
Lo-Fi Version | Time is now: 23rd April 2024 - 10:17 PM |