Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Is it possible to redirect local ipaddress to domain/subdomain name in linux?
I know it is possible with DNSMasq but my modem doesn't support that.
For testing locally, edit your /etc/hosts file to route subdomain.domain.com to localhost:
127.0.0.1 subdomain.domain.com
DNS will resolve requests to subdomain.domain.com to your local server.
Going the opposite direction, you can setup a reverse proxy to route localhost to a staging or production environment such as subdomain.domain.com. Edit httpd.conf or apache2.conf to include a ProxyPass.
For Apache, this requires mod_proxy module, loading modules proxy_module and proxy_http_module.
Of course, if you are not targeting specific environments, you could simply use relative paths.
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
My website on Debian 9 doesn't allow to download any .ini files located in any folders. How to allow downloading of .ini files at least from a specific folder using .htaccess?
You should ideally find where and how these files are being blocked as it may require additional steps to "unblock". However, you can try something like the following in the .htaccess file in the directory that you want to permit access to all .ini files:
<Files "*.ini">
Require all granted
</Files>
Update from OP:
In error.log I see the following:
ModSecurity: Access denied with code 403 (phase 2). Matched phrase ".ini/" at TX:extension.
I can solve this problem by adding a new directive for Apache:
<IfModule mod_security2.c>
SecRuleRemoveByTag CWAF
</IfModule>
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have a file called video.php on my domain but want it on my subdomain.
now its like www.domain.com/video.php?id=parameter&fewotherparamer=1233
and I want to change it to
video.domain.com/video.php?id=parameter&fewotherparamer=1233
how would this be possible? I already tried to find out using google and the searchfunction here, but didn't find the point.
Thanks
add these directives to .htaccess file in domain.com root directory (or virtual host config) and make sure you enabled mod_rewrite module
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www\.)?domain.com$ [NC]
RewriteRule ^video.php$ http://video.domain.com/video.php [R=301,NC,L ]
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I have two servers A (192.168.1.100) and B(192.168.1.101) on my local network and one external IP. I would like to forward the HTTP request based on the sub-domains. For instance i would like to have any http request to a.example.com would go to server A 192.168.1.100 and any request to b.example.com go to server B 192.168.1.101. Is there any options that I can implement on Server A Apache configuration files to do this?
I think, this could be better handled by a router or an iptables rule.
This said, you could setup a virtual host entry on machine A, forwarding all requests to your second machine B
<virtualHost *:80>
ServerName b.example.com
RewriteEngine On
RewriteRule .* http://192.168.1.101$0 [P]
</VirtualHost>
The [P] flag forwards the requests to mod_proxy, so this must be enabled. Another caveat is the performance warning at RewriteRule Flags - P|proxy.
Last point, this is untested, so please be careful.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
How do I can download the default web page from a domain using wget ? Example:
www.mydomain.com returns index.html as default page and www.newdomain.com returns default.html as default page. So, using wget as wget [options] www.mydomain.com must download index.html and wget [options] www.newdomain.com must download default.html.
wget [options] www.mydomain.com/index.html
wget [options] www.newdomain.com/default.html
Wget supports filenames not just domain names.
You will never know what the default name of a file is (as a end user) only the server knows this. When you send a response to www.domain.com what the webserver for www.domain.com gets is GET / the webserver then looks in the / directory and discovers what the default file is (index.html, default.html or anything else the server admin has set as the default. You then just get sent that copy back. So you don't need to do anything as the end user to get the default page, it just happens by itself.
Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
i have a private section where specific users can login on my system (restricted to 4 users)
i want to add IP restriction in the .htaccess using:
<Limit GET POST PUT>
order allow,deny
allow from 127.0.0.1
allow from 192.168
allow from 67.xx.xx
# etc..
deny from all
</Limit>
but i get this error:
Forbidden
You don't have permission to access / on this server.
Additionally, a 403 Forbidden error was encountered while trying to use an ErrorDocument to handle the request.
when i try to access this site locally (i have lamp on my desktop installed, my host file is setup correctly and my apache config is good too)
if I go to my site locally i can see my site with mod-rewrite and errordocument. everything is working fine
why do i get an access denied when i put the restrictin?
you can first deny and then allow:
order deny,allow
deny from all
allow from 127.0.0.1
allow from 192.168
allow from 67.xx.xx
# etc..
obviously I can not test with your setup, but that's what I do.