Redirect link - Printable Version +- Post4VPS Forum | Free VPS Provider (https://post4vps.com) +-- Forum: VPS Discussion (https://post4vps.com/Forum-VPS-Discussion) +--- Forum: VPS Support (https://post4vps.com/Forum-VPS-Support) +--- Thread: Redirect link (/Thread-Redirect-link) |
Redirect link - Melvin - 06-06-2019 I already change the site port 80 throw another port so i was wondering if this could be possible, when people type the server site with default port it will redirect him throw another link is that possible with Apache ? OS: Debian 8 Jessie RE: Redirect link - tiwil - 06-06-2019 Do you mean by, User A opened blabla.com, and redirected to blahblah.net by Apache? AFAIK, this is possible, but since I'm a newbie, I'll leave what I found on Google. https://www.linode.com/docs/web-servers/apache-tips-and-tricks/redirect-urls-with-the-apache-web-server/ RE: Redirect link - Mashiro - 06-06-2019 It can be done via the firewall without any changes to the web server. Code: iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports <new port here> Try the rule above. Don't forget to change the <new port here> part to the port that you want to redirect to. An alternative: Code: iptables -t nat -I PREROUTING --src 0/0 --dst <your server ip> -p tcp --dport 80 -j REDIRECT --to-ports <new port here> Here again make sure you adjust <new port here> and also <your server ip>. If the server is OpenVZ and doesn't have the NAT iptables modules loaded on the hostnode the commands might fail. In that case you might have to build a vHost on port 80 that redirects to the other port. For that take a look at this: https://stackoverflow.com/a/13089668 My references for the iptable rules: - https://www.cyberciti.biz/faq/linux-port-redirection-with-iptables/ - https://wiki.debian.org/Firewalls-local-port-redirection P.S.: "throw"? You mean "to". Throw means absolutely something different. RE: Redirect link - Melvin - 06-06-2019 Thanks for replying but i found a results by my own. after some research i finally got it, actually i'm using apache 2 so i have edited /etc/apache2/apache2.conf there where i enabled .htaccess by changing AllowOverride None to AllowOverride All. And use those commands to restart apache2 Code: systemctl restart apache2 RE: Redirect link - humanpuff69 - 06-06-2019 (06-06-2019, 12:07 AM)Melvin Wrote: I already change the site port 80 throw another port so i was wondering if this could be possible, you can redirect it many ways using apache using apache itself , using simple php script . just header(Location and die() , using javascript or using html meta tag redirect header i mostly use the php location and nginx redirect because i only use apache for phpmyadmin RE: Redirect link - Melvin - 06-06-2019 (06-06-2019, 10:27 AM)humanpuff69 Wrote: you can redirect it many ways using apacheapache for my public html already installed with my Game panel it just allow .htaccess from apchace2.conf SO i can redirect and edit my site. RE: Redirect link - Mashiro - 06-06-2019 Glad to see you found something that works. I totally forgot about using rewrite via htaccess. Hehe. I'm using the redirect option in Nginx. Apache isn't my thing so I must have totally forgotten about htaccess. |