Problems activating your account? Send notification email to: [email protected]
Host4Fun Budget VPS Hosting
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.
Reply
#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".
Reply
#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.
Reply
#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.
Reply
#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.
Reply
#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.
Reply
#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.
Reply
#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.
Reply
 


Possibly Related Threads...
Thread Author Replies Views Last Post
Question [Debian-10]mysql-server error Rehan 3 60 11-27-2020, 02:53 AM
Last Post: Rehan
  libssl.so.1.1 error in ubuntu sagher 18 818 06-17-2020, 04:32 PM
Last Post: Mashiro
  ufw error sagher 6 324 06-11-2020, 06:31 PM
Last Post: rudra
  CyberPanel Installing Error huuthi95 8 801 02-13-2020, 09:50 AM
Last Post: deanhills
  Change hostname error sohamb03 5 910 12-08-2019, 11:43 AM
Last Post: deanhills

Forum Jump:


Users browsing this thread: 1 Guest(s)

Sponsors: VirMach - Host4Fun - CubeData - Evolution-Host - HostDare - Hyper Expert - Shadow Hosting - Bladenode - Hostlease - RackNerd - ReadyDedis - Limitless Hosting


About Post4VPS

Post4VPS is a forum/destiny where you can Delploy Your Free VPSs just by the Power of Posts.

We Provide VPSs of many locations like Germany,US,Canada,France,London,etc.

We also Provide VPSs of Both Linux and Windows OS.