Questions tagged [.htaccess]
Directory-level configuration file found mostly on Apache web servers
2,829
questions
0
votes
1
answer
970
views
existing file gives 404 due to a RewriteCond rule in .htaccess
To redirect a specific domain name to a folder in my public dir, www/, I edited .htaccess to the following:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(.+)?domain.com$
RewriteRule ^(/)?$ domain.com/$...
1
vote
0
answers
2k
views
PHP.ini custom settings through htaccess
I'm confused by this ini list in the PHP Manual: http://www.php.net/manual/en/ini.list.php
I want to set some custom php.ini values through htaccess, but which one of these commands is not going to ...
2
votes
1
answer
3k
views
htaccess: multiple redirections depending on domain name
I have a server and a few domains and two webpages. Can't figure out how to do the following:
A.com -> root\
www.A.com -> root\
B.com -> root\
www.B.com -> root\
C.com -> root\folder1\
...
1
vote
1
answer
2k
views
nginx: rewrite a non-existent php-file to another php-file with all arguments
i really need help here. Sitting for some time now and dont figured it out.
I want to realize a very simple task - rewrite a non-existent php file to another existant php file with all arguments like:...
0
votes
2
answers
7k
views
You don't have permission to access / on this server. Apache, win 7
read all the posts regarding this issue - and none of them seed to help my instance...
I just moved all my dev stuff form a vista machine (where it worked fine) to a Windows 7 machine - Apache 2.2... ...
4
votes
3
answers
25k
views
.htaccess error "not allowed here" for all for all instructions
I am using Debian Lenny and Apache 2. I changed the default .htaccess file with:
AllowOverride AuthConfig
But I always get the error message not allowed here when putting any instructions in the ....
1
vote
1
answer
4k
views
Disallow everything in directory except subdirectories with certain name using .htaccess or vhost.conf
How can I disallow everything in a directory except any subdirectories that have a certain name using htaccess or even vhost.conf for the site? I have a protected main directory which contains ...
1
vote
1
answer
2k
views
Apache htaccess RewriteRule to remove trailing slash; infinite loop?
I use the following in .htaccess (mod_rewrite) to remove the trailing slash from my URLs:
RewriteRule ^([a-z0-9_-]+)/$ $1 [L,NC,R=301]
Of course, since the character class doesn't match a slash, ...
1
vote
1
answer
1k
views
Prevent redirect loop in mod_rewrite
I'm writing a rule in my htaccess that basically says this:
If the request is for the homepage
And a cookie has not been set
Rewrite the page with /addCookie.php
Then in addCookie.php, we set the ...
0
votes
2
answers
487
views
How to block a user in apache httpd server from accessing a *.php file inside a Directory, instead user should access this using Directory name
My requirement looks Simple, But Googling Did not help me yet.
my query is
i want to Throw a 404 page to a user(Not Re-Direct to another folder or file),
who is trying to Access *.php ...
1
vote
1
answer
2k
views
Rewrite subfolder to subdomain with Apache htaccess
Here's the situation:
I recently re-structured my website at www.pixelscrapper.com. I still have the old legacy website at legacy.pixelscrapper.com (hosted on the same server). Is it possible to use ...
-1
votes
1
answer
2k
views
MODX Evolution send all webtraffic to https [duplicate]
Possible Duplicate:
Apache rewrite rules and DNS settings for HTTPS sites
I have just added a SSL sertificate to a site, and the site should only answer on https. People that visit http should be ...
1
vote
2
answers
2k
views
URI Rewrite with fake subdomains and multiple variables
Can someone please help with trying to use mod rewrite so foo.domain.com is rewritten to domain.com/p.php?s=foo and foo.domain.com/bar to domain.com/p.php?s=foo&p=bar?
Currently my .htaccess is:
...
1
vote
2
answers
6k
views
htaccess redirect everything except two files
Would anybody know how to write an .htaccess file that will redirect ALL traffic for ALL requests to index.php except for two files.
And in this process, also redirect any request without "www" to "...
1
vote
1
answer
497
views
Can I redirect to the newest file in directory using .htaccess?
I want to create .htaccess rule for situation like below:
I have a link to file: http://something.com/images/some/image_001.png
If this file doesn't exists I want to redirect to the newest file in /...
0
votes
1
answer
366
views
Apache2 .htaccess rewrite rule to Lighttpd
could you help me to convert this rewrite rule from apache2 to lighttpd
RewriteEngine on
RewriteBase /
RewriteCond %{HTTP_REFERER} !^http://my-site\.net/ [NC]
RewriteCond %{HTTP_REFERER} !^http://www\...
1
vote
1
answer
173
views
how to make this htacess rewrite rule stop failing because of final parameter
I have this URL rewrite rule
RewriteRule ^(send-your-request.*)$ / [NC,L,QSA,R=301]
it should basically just remove "/send-your-request" from the the URL (i.e. rewrite it with query string ...
0
votes
1
answer
2k
views
Redirect non-existent subdomain to base domain url
I was using Droplr with my domain, 'example.com', prepended with 'u.'. (u.example.com). The prepend was not a subdomain, and would redirect to Droplr via an A record to their server's IP Address.
...
1
vote
1
answer
441
views
RewriteCond for multiple files
In htaccess file, RewriteCond for one file bla.php can write so right?
RewriteCond %{REQUEST_FILENAME} !bla.php
Question: how can write RewriteCond for multiple files? for example for 3 files: bla....
2
votes
2
answers
313
views
Apache 2 does not load mod_deflate
I'm running Apache 2 on a Redhat Enterprise Linux 5.8 x86_64 standard box, and can't seem to get mod_deflate enabled.
This is a WHM installation, so I am making amendments to one of the include files ...
1
vote
1
answer
66
views
Redirect IP's that don't match
I have a wordpress site that is at a URL and I am wanting to redirect all traffic except a few IP address to a coming soon type page.
So if I had 3 IP's, those 3 IP's would see the current wordpress ...
1
vote
1
answer
4k
views
htaccess Redirect / RedirectMatch with URLs that contain Special / Encoded Characters
I'm currently in the process of applying a variety of 301 redirects in an .htaccess file for a website that recently changed its structure. Everything is working as expected, except for URLs that ...
0
votes
1
answer
671
views
Apache2 URL Rewrite - Second-Level-Domain to the end of URL
i have a site "example.com" and also many other domains like "example1.com", "example2.de", etc.
I want that every Second-Level-Domain is rewritten in the following way:
example.com/domainredirect=...
4
votes
2
answers
8k
views
How to dynamically reload nginx config
I'm currently trying to setup Nginx for a domain with production, testing and development stages. Each comes with it's own partial Nginx config file with rewrites.
The production and testing stages ...
2
votes
0
answers
114
views
Opencart .htaccess
I am pretty new to OC and am running the latest version. I am ready to open up my site to the (potentially) many hundreds of people whom I hope will have a look, like something and then buy it!
My ...
0
votes
1
answer
1k
views
Change the response body in apache based on request method
I have an apache server that I'd like to configure to behave differently when the request method is OPTIONS. This is a static site so doing it in a scripting language isn't possible. In my case when ...
3
votes
1
answer
3k
views
htaccess IP blocking with custom 403 Error not working
I'm trying to block everyone but 1 IP address from my site on a server running apache & centos. My setup is follows the example below.
My server:
`http://www.myserver.com/`
My .htaccess file
&...
1
vote
2
answers
305
views
Securing php on a shared apache
I'm going to install apache+php in a server where two users, A and B, will deploy their website. I'm trying to achieve isolation of users' space for security reasons: that is no scripts from site A ...
1
vote
1
answer
2k
views
Configure .htaccess to block bot indexing but allow browser directory listing/viewing
I know in order to show a directory listing of my files in a browser through .htaccess I can use
Options +Indexes
and to prevent Google and most bots from crawling my directory I can use
Options -...
0
votes
3
answers
3k
views
How do I force .htaccess authorization to occur over ssl?
I'm trying to force a particular directory to require only allowed IPs and a valid username/password through basic authorization. To ensure that the username/password are sent in encrypted form, I ...
0
votes
1
answer
1k
views
apache redirect htacess on error 500
Im trying to redirect on Error 500 , but its not happening.
.htaccess file
ErrorDocument 500 /custom.php
custom.php just has a
echo '<h1>ERROR OCCURED </h1>';
should I configure ...
0
votes
1
answer
932
views
htaccess rewrite different folder url, two index files
I've been searching for awhile now and haven't found anything that comes close to what I'm trying to accomplish.
Right now my URL's look like this:
www.website.com/something
which are using the ...
0
votes
1
answer
524
views
force all urls to www and force domain to non-www
I was trying to force my domain to redirect without www and could success through this code:
.htaccess:
RewriteCond %{HTTP_HOST} ^www\.domain\.com [NC]
RewriteRule ^(.*) http://domain.com/$1 [R=301,...
3
votes
2
answers
3k
views
.htaccess to block by file name possible?
I have a bunch of files that are secure_xxxxxx.php. Is there a way to use .htaccess to block access to all the secure_* php files based on IP?
EDIT:
I've tried but I get 500 errors
<FilesMatch "^...
3
votes
3
answers
4k
views
.htaccess has no effect
I am loosing hours with this (should-be) simple task. I want to restrict access to my website, which is on my server in /var/www/.
I've created /etc/apache2/passwords file with httpasswd successfuly (...
1
vote
1
answer
80
views
Linking domain name to subdirectory without displaying subdirectory name in address
I've got a domain name, blogdomain.com, which I've linked to otherdomain.com/blog using this .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^(www.)?blogdomain.com$
RewriteRule ^(/)?$ blog [...
1
vote
0
answers
185
views
Why forbidding all php files from a directory with mod_rewrite denies access to the directory listing?
Server: Apache 2.2.17
I have the next .htaccess file:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule !^includes/ - [S=1]
RewriteRule ^includes/[^/]+\.php$ - [F,L]
RewriteRule ^index\....
-2
votes
1
answer
2k
views
htaccess hacked - i've deleted code and file - what next? [duplicate]
Possible Duplicate:
My server’s been hacked EMERGENCY
My website was hacked recently. I think i've found the code that was added to the htaccess file, deleted it and then added script to prevent ...
1
vote
2
answers
9k
views
Hide directory contents from showing when accessing the URL directly
On my site, if you browse to http://example.com/images/ the contents of the entire directory are shown like so:
How can I make it so that this doesn't happen?
Can I create an .htaccess file in ...
0
votes
2
answers
13k
views
.htaccess redirect, from old dirty URL to a clean new URL with parameters
I have the following 2 links, I'm not great with .htaccess rules yet.
Old URL: http://www.mywebsite.org.uk/donate/donate.php?charity_id=885&project_id=18111
New URL: http://new.mywebsite.org.uk/...
0
votes
3
answers
788
views
Does Apache use any other dot ht files besides .htaccess and .htpasswd?
I'm hardening my Apache server config and wondering if it uses any other "^.ht.+" files besides .htaccess and .htpasswd?
0
votes
1
answer
2k
views
.htaccess - how to avoid a subdomain to be seen on google or similar?
I have the following htaccess file for your consideration:
Options +FollowSymlinks
#+FollowSymLinks must be enabled for any rules to work, this is a security #requirement of the rewrite engine. ...
1
vote
1
answer
145
views
How do I point a domain to a specific directory? [duplicate]
Possible Duplicate:
Hosting multiple distinct folders for distinct domains
I have two domains pointing to the same IP address.
They both go to the directory /public_html/www/.
What is the best ...
1
vote
1
answer
1k
views
Apache Error 500 without log info when trying to access to a php5.3 website
I've the next problem. I had to do some rewriteUrl-work for a website... Well, in fact, I had to modify the already working urlRewriting. Being cautious, I saved a copy of the whole source code, even ...
1
vote
1
answer
4k
views
Configuring htaccess with django and apache
I am trying to configure my apache server with django. I am having issues matching urls to their views and am not quite sure of the cause of the problem. I have the following configuration:
....
0
votes
1
answer
2k
views
Rewrite URL based on HTTP_HOST
Basically I want users can access the page via intranet and internet.
If users access the page via intranet, they can typing intranet IP of server on their browser address bar to 192.168.x.x.
But ...
1
vote
1
answer
1k
views
Can you stop a SYN Flood attack with .htaccess?
[Linux - CentOS - Apache - VPS]
Last week my servers came under a SYN Flood attack, my hosting provider took some steps and resolved the issue. One of the things that they did was turn on SYN Cookies....
3
votes
2
answers
4k
views
mod_rewrite remove trailing slash is causing loops
I have a site using mod_rewrite to make pretty URLs ... everywhere I read the removing the trailing slash is good for SEO and therefore I went with the rule:
RewriteRule ^(.+)/$ /$1 [R=301,L]
I ...
1
vote
1
answer
1k
views
htaccess rewrite rules to match dynamic params
My base url looks like this.
http://localhost/test/s/beer-drinks
And depending on the users input it can be something like this.
http://localhost/test/s/beer-New-York-drinks_alcoholic-No_rating-2-...
0
votes
1
answer
78
views
htaccess not properly rewriting urls
This is a bit of a weird one. I'm doing some work on a server, and I need rewrite rules for directories that actually exist (in some cases, they are more than one level deep)
At the moment my ....