arrow_upward

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Apache Redirect Error Ubuntu Server
#1
Hello All,

I was just notified today that my cPanel host is closing their doors Dec 7 so I am in the process of moving my main domain over to my VPS. I am currently running into an issue where tbelldesign.co is redirecting to dev.tbelldesign.co and I am not sure how to remedy the problem. I have cruised around the internet for a bit and I am not fining any viable solutions, so I am wondering if anyone else has seen this issue and know how to fix it. Thanks!
Thank you to CubeData and Posts4VPS for the services of VPS 8.
#2
So without further detail how do you know it is caused by Apache?

Have you checked your vHost and .htaccess files? Do you have a redirection somewhere in your site code maybe? Do you use CNAME DNS records?

With that little information we can only guess or rather said "cruise around the internet for a bit and find no viable solutions".
[Image: zHHqO5Q.png]
#3
(11-11-2020, 01:50 PM)Mashiro Wrote: So without further detail how do you know it is caused by Apache?

Have you checked your vHost and .htaccess files? Do you have a redirection somewhere in your site code maybe? Do you use CNAME DNS records?

With that little information we can only guess or rather said "cruise around the internet for a bit and find no viable solutions".

I did check my vHost and .htaccess file and everything was on the up and up. I can post those when I get home this evening, but I think I found a solution that might work. I created a new site.conf in sites-available under apache2 and enabled it, after reading a KB from apache in the wee hours of the night last night, I think what I need to do is disable the second site and modify the original .conf so that it falls inline with Name Based Virtual Host, so in the end my configuration would look similar to this.

NameVirtualHost *:80

<VirtualHost *:80>
ServerName www.domain.tld
ServerAlias domain.tld *.domain.tld
DocumentRoot /www/domain
</VirtualHost>

<VirtualHost *:80>
ServerName www.otherdomain.tld
DocumentRoot /www/otherdomain
</VirtualHost>

Where the first one would be tbelldesign.co and the other would be dev.tbelldesign.co. In my current readings this seems to be the path of least resistance and I will check in once I have tested it out.
Thank you to CubeData and Posts4VPS for the services of VPS 8.
#4
Report back if you have any luck with your findings.

Feel free to post your current vHost configuration and the used .htaccess files.

If as you say you have no redirect in your code or via htaccess or via DNS records then most likely the vHost is indeed the issue and your findings might solve the problem.

IP based vHosts are bit problematic if you have only a single IP address but multiple hostnames / domains.
[Image: zHHqO5Q.png]
#5
Okay, so I have tried the above method with the same results happening. Below is my vHost and DNS entries. What I am not understanding is the .htaccess portion, I keep seeing conflicting entries where people are setting it up in the main domain folder and the subdomain folder.

NameVirtualHost *:80

<VirtualHost *:80>
    ServerName tbelldesign.co
    ServerAlias www.tbelldesign.co
    DocumentRoot /var/www/tbelldesign.co/public_html/

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory /var/www/tbelldesign.co/public_html>
         Options Indexes FollowSymLinks MultiViews
         AllowOverride All
         Order allow,deny
         allow from all
    </Directory>
</VirtualHost>

<VirtualHost *:80>
    ServerName dev.tbelldesign.co
    DocumentRoot /var/www/tbelldesign.co/public_html/

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    <Directory /var/www/dev.tbelldesign.co/public_html>
         Options Indexes FollowSymLinks MultiViews
         AllowOverride All
         Order allow,deny
         allow from all
    </Directory>
</VirtualHost>


Main Domain - Type A - @ - Points to SERVERIP
Sub Domain - Type CNAME - Points to @

Any help would be appreciated, I have been looking through a few items online and I keep getting redirected back to the main tbelldesign.co site from dev.tbelldesign.co
Thank you to CubeData and Posts4VPS for the services of VPS 8.
#6
Are both of your Apache vHosts supposed to have the same document root directory? The dev vHost also points to the production document root directory. That explains dev.tbelldesign.co going to or rather said displaying the content of tbelldesign.co.
[Image: zHHqO5Q.png]
#7
(11-14-2020, 11:01 PM)Mashiro Wrote: Are both of your Apache vHosts supposed to have the same document root directory? The dev vHost also points to the production document root directory. That explains dev.tbelldesign.co going to or rather said displaying the content of tbelldesign.co.

No and I think I mistyped that. Just reconfigured SSH after making that post. I ended up getting it worked out. There was an issue with GoDaddy where my dns settings were not taking. Everything is sorted out now. Thank you for you help and pointers!
Thank you to CubeData and Posts4VPS for the services of VPS 8.
#8
Now you may see why it is important to provide such information as your vHost configuration files and etc. You pin pointed it to Apache already yourself which was great! It could as well have been a DNS issue (e.g. the dev record if it were a CNAME record could be accidentally pointed to the main domain). In that case it was a wrong document root for the dev vHost which can easily happen.

Cheers.
[Image: zHHqO5Q.png]
lockThread Closed 


Possibly Related Threads…
Thread
Author
Replies
Views
Last Post
8,699
02-24-2021, 07:17 AM
Last Post: Pacific Spirit
2,129
11-27-2020, 02:53 AM
Last Post: Rehan
11,303
06-17-2020, 04:32 PM
Last Post: Mashiro
2,460
06-11-2020, 06:31 PM
Last Post: rudra

person_pin_circle Users browsing this thread: 1 Guest(s)
Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - Hyper Expert - Shadow Hosting - Bladenode - Hostlease - RackNerd - ReadyDedis - Limitless Hosting