Tag Info

New answers tagged

0

Easy. Just set something like this within your main configuration or your virtual configuration: <Directory /var/www/path/to/your/web/documents> Order Deny,Allow Deny from all Allow from 127.0.0.1 ::1 Allow from localhost Allow from 192.168 Allow from 10 Satisfy Any </Directory> The <Directory></Directory> statement ...


0

Add this section inside your virtual host directive: <Location /mypathurl> Order deny,allow Deny from all Allow from 192.168.1.10 </Location> Replace your IP above. This should not be used for financial level security, FYI.


0

to clarify your question it seems like you have a broken image link after a sever migration on drupal based site? when the link was created you must have visited your server by ip address vs domain name. then drupal created a full link to the image versus creating a relative link. you should update whatever code, module or plugin that is generating the ...


2

For your first two rewrites (non-www → www, http → https), the following rule should work: RewriteEngine On RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} !=www.example.com [NC] RewriteRule ^(.*) https://www.example.com/$1 [NS,L,R=permanent] Just replace www.example.com with the actual canonical hostname of your site. As for your third ...


2

You can't check for the query string using the RewriteRule pattern (the query string is stripped before pattern matching, as is the hostname, etc). So, the rules you stated above simply won't match and you'll get a 404. However, you can use the RewriteCond directive to check the query string: For example: domain.tld/en/abc.php?foo to ...


0

People trying to access your website may need to edit their hosts files and force their machine to a specific IP when accessing your domain. If it's working fine locally but not from others on the web it's likely a DNS issue.


1

I had to ask this question myself. It is surprisingly tricky to do. Olaf Dietsche provided the solution of using an environment variable: RewriteRule ^contact$ contact.php [L,E=CLEAN_CONTACT_URL:1] RewriteCond %{ENV:REDIRECT_CLEAN_CONTACT_URL} !1 RewriteRule ^contact\.php$ /contact [R=301,L] That way the redirect only gets executed when contact.php is ...


0

You are mixing the mod_alias and mod_rewrite modules, which means that the end result is often unexpected. You should only use mod_rewrite in your case, that is, repöace your Redirect 301 /contact.php http://www.example.com/contact with RewriteRule contact.php http://www.example.com/contact [R=301,L] And then, as Dave mentioned, you should use the [L] ...


0

Use the [L] flag on your rewrite rule and place your redirect before it. (I'm going to use a rewrite here as well) RewriteRule ^/contact\.php$ http://www.example.com/contact [R=301,L] RewriteRule ^contact$ /contact.php [L] When the first rule is encountered it matches the /contact.php request and is the last rule processed. The redirect to /contact does ...


1

Yes you would. You are telling Apache to take any reference to contact and rewrite the URI to contact.php then telling Apache to take any contact.php reference and change it to /contact which gets captured again by the first rule. Here is what you are missing. For each rewrite or redirect, Apache makes the change then starts the whole matching process over ...


1

The use of a rewrite condition along with a rule to map transparently to the subdirectory should work. RewriteCond %{HTTP_HOST} ^abc\.mybiz\.domain\.com$ [NC] RewriteCond %{REQUEST_URI} ^(/|.*\.html)$ [NC] RewriteRule ^/(.*)$ /abc/$1 [L] Now when a request for http://abc.mybiz.domain.com/ or http://abc.mybiz.domain.com/index.html is made it will be pulled ...


7

Empty Virtual Host With virtual hosting, all traffic is routed to an IP address and then Apache matches the hostname. When virtual hosting using NameVirtualHost is enabled, the site that responds to the IP address is the first one listed in the Apache configuration file. So you can use a null virtualhost: <VirtualHost 192.168.1.1:80> ...


2

You could simply redirect the user to the named host: # Uncomment the line below if not previously added in the file # RewriteEngine On # Rule to redirect to the named host # Replace [xx.xx.xx.xx] woth your host's IP address # Replace [yourdomain.com] with your host's proper URL RewriteCond %{HTTP_HOST} ^xx\.xx\.xx\.xx$ RewriteRule (.*) ...



Top 50 recent answers are included