LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   How to redirect all http-requests from devices connected via AP to localhost or the static ip address of rpi? (https://www.linuxquestions.org/questions/debian-26/how-to-redirect-all-http-requests-from-devices-connected-via-ap-to-localhost-or-the-static-ip-address-of-rpi-4175620997/)

alaayush 01-05-2018 05:42 AM

How to redirect all http-requests from devices connected via AP to localhost or the static ip address of rpi?
 
I have created a website which has plenty of movies/songs using laravel framework and apache server in Raspbian Stretch.

Also, I have configured rpi as an AP and i want to redirect all http-requests from devices connected via AP to the localhost or the address of pi.

After searching for days, i have made some requests to redirect by adding the line address=/#/ip_address_of_pi in /etc/dnsmasq.conf. But it doesn't redirect all requests like youtube.com, facebook.com

I have series of other questions related to this which are:

1. When i enter a site, say google.com, it gets redirected to localhost but the url bar still says google.com. How to make it change to localhost in url too.
2. google.com gets redirected but google.com/someaddress doesn't. why?

my /etc/dnsmasq.conf is:

Code:

interface=wlan0
    listen-address=192.168.1.2
    dhcp-range=192.168.1.3,192.168.1.23,255.255.255.0,12h
    address=/#/192.168.1.2

/etc/dhcpcd.conf is:

Code:

interface wlan0
    static ip_Address=192.168.1.21
    static domain_name_servers=192.168.1.2 127.0.0.1

/etc/resolv.conf is: generated by resolvconf

Code:

nameserver 127.0.0.1
/etc/hosts is :

Code:

127.0.0.1    localhost
    127.0.0.1    raspberrypi
    127.0.0.1    www.mysite.com (name of site i created)

Any help will be greatly appreciated. Thanks!

descendant_command 01-07-2018 03:30 AM

Maybe have a default vhost (that answers to any name) on your Pi with a redirect to the site on a named vhost.


All times are GMT -5. The time now is 08:36 PM.