Questions tagged [.htaccess]
Directory-level configuration file found mostly on Apache web servers
2,828
questions
1
vote
0
answers
379
views
.htaccess to pass FULL URL into other PHP link as $_GET
From .htacces file, how to pass/redirect the FULL URL to another URL as GET Variable?
Like:
http://www.test.com/foo/bar.asp
will be redirected to:
http://www.newsite.com/?url=http://www.test.com/...
0
votes
1
answer
1k
views
need help from some professional how to redirect old or invalid url
I recently upgraded a site and almost all URLs have changed. I have redirected all of them (or so I hope) but it may be possible that some of them have slipped by me. Is there a way to somehow catch ...
0
votes
2
answers
70
views
.htaccess forcing https
I have this rewrite rule:
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/(register|login)
RewriteCond %{HTTPS} !=on
RewriteRule (.*) https://%{SERVER_NAME}/$1 [L,R]
I have several others that I need ...
3
votes
1
answer
3k
views
How to exclude IP from htaccess domain redirect [duplicate]
I'm trying to write a custom redirect rule for some testing purposes on 2 domains with exactly same site. The code I am using is:
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4$
...
0
votes
1
answer
436
views
Htaccess Redirect with domain attributes
I have to write a redirect rule for the below condition.
www.domain.com/custom.aspx?ATTR=VALUE to
www.domain.com/custom?ATTR=VALUE
How can this be achieved using the .htaccess
I have the below ...
0
votes
1
answer
96
views
HTTPS of for a subdomain
My site has a normal SSL installed and these are the changes I made in .htaccess
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{HTTP_HOST}...
1
vote
1
answer
89
views
Configuring HTACCESS in a sub directory
I have an htaccess file in my main directory which redirects all top-level directories to a PHP file.
-> /Loch would go to /profile.php?username=Loch
But I also have a subdirectory, lets call it ...
6
votes
9
answers
5k
views
Successfully, permanently ban a user from a website? [closed]
I have a social networking website and I want to ban a user from the website. I've added his IP address to the ban list in the .htacess file and to the php level for banning that user, but he keeps ...
1
vote
1
answer
72
views
Dynamic to static
My site is an e-commerce site. All URLs are dynamic, like "my_domain/a.php", "my_domain/a.php?id=1", "my_domain/b.php", "my_domain/b.php?id=3", etc.
I want static URLs like "my_domain/a.html","...
1
vote
2
answers
412
views
htaccess RewriteRule results in 404 response
I have a website that is in the root folder. It has a .htaccess with teh code below:
RewriteEngine on
RewriteRule ^(.*)/$ $1.php
When I open http://example.com/login/ I get a "404 Not Found" error ...
0
votes
1
answer
61
views
Tracking down a strange apache rewrite
The tl:dr; How would you go about tracking down a url rewrite that should not be happening?
The details:
I have one .htaccess file and it is simply:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME}...
0
votes
1
answer
129
views
Using iptables to show users from specified IP a website
I'm currently using iptables to block access to known ip ranges used by spam servers (specifically Ubiquity servers). My concern is that over time I know that ip ranges can change hands and I don't ...
0
votes
1
answer
226
views
URL redirection from .php to .html [duplicate]
Possible Duplicate:
redirect *.php to *.html
My URL is index-main.html and it is redirecting to index-main.php, only index-main.html is showing on the address bar. My .htaccess file is:
<...
0
votes
2
answers
2k
views
After enabling ReWriteLog in .htacess, I failed to open my web site.
.htaccess worked well at first, then I added two lines to my .htacess to enable RewriteLog. The result is that I failed to open my web site.
The two lines I added to my .htaccess are as follows:
...
1
vote
1
answer
1k
views
How do I block repepating requests? Should I do it with Apache2 config or .htaccess?
I want to block the same repeating requests to my website. For example, someone hits "Refresh" button 3 times, so I want the same requests following from that user to be auto blocked.
I know I can do ...
0
votes
1
answer
1k
views
Apache - Redirect with ErrorDocument 403
ErrorDocument 403 /down.php
order deny,allow
deny from all
allow from xxx.xxx.xxx.xxx
This just keeps feeding me the forbidden page without redirecting. I'm trying to deny all IPs except my own, and ...
0
votes
2
answers
1k
views
Change php's auto-append-file from a script
I am using the php config auto-append-file to append code that i need to be executed on all pages on a particular domain.
But my problem is that there are other domains that share the same php.ini ...
0
votes
2
answers
129
views
301 redirect a query string
i'm trying to to do a 301 redirect for a query string but can't figure it out. This is what it would be if it were a regular 301:
Redirect 301 /vetements/robes-de-grossesse.html?limit=all http://www....
2
votes
1
answer
1k
views
mod_rewrite in alias directory not working
I have a wp blog which lives under /var/www/mysite.com/blog and is accessible via www.mysite.com/blog
When visiting www.mysite.com/blog/ I see the index page, but all links on subdirectories are no ...
0
votes
1
answer
134
views
How to convert this .htacess to nginx
I need to convert
RewriteEngine on
RewriteBase /generate
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/(.*)/ index.php?file=$2
To nginx conf
Can anyone ...
3
votes
1
answer
338
views
Trouble with www. redirect (.htaccess)
I'm trying to get a simple www. to non www. redirect set up. Here's the .htaccess
DirectoryIndex index.php
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.org [NC]
RewriteRule ^(.*)$ http://...
3
votes
2
answers
6k
views
How should I separate public and private pages on my webserver?
What I want to achieve
I have public and private sites on my webserver, and I would like to somehow separate them, but I want this separation to be invisible.
So for example DocumentRoot is /var/www ...
0
votes
1
answer
1k
views
htaccess rewrite subdomain and requests uri
Having trouble with a rewrite condition within my htaccess. I need to redirect the request from a subdomain. However, there are three subdomains for each language: en.foo.com, es.foo.com, www.foo.com. ...
-3
votes
1
answer
148
views
Protecting a chmodded 0777 cache directory?
A website I'm developing requires several directories to have their permissions set to 0777. The directories are used as cache directories for HTML and PHP files generated by the website.
The ...
2
votes
1
answer
1k
views
.php files see Apache environment variables, .html files don't
Consider this environment:
$ cat .htaccess
AddType application/x-httpd-php .php .html
SetEnv Foo Bar
$ cat test.php
<?php
echo "Hello: ";
echo $_SERVER['Foo'];
echo $_ENV['Foo'];
echo getenv('Foo'...
1
vote
1
answer
2k
views
Parsing .html as PHP: how to check which method would be right?
The usual way of parsing .html files as PHP is to add either the first (PHP as an Apache module) or both (PHP as CGI) of the following lines to an .htaccess file:
AddType application/x-httpd-php ....
2
votes
1
answer
142
views
.htaccess works for virtualhost but not for public_html
The problem is when I have a docroot pointing to some user's public_html/*.
Say there is a virtualhost with Docroot /home/user/public_html/www - there .htaccess works. Yet when I go to example.com/~...
5
votes
3
answers
794
views
Is my webserver allowing pre-fetching?
I have an image based website that hosts multiple galleries. When a user clicks one of the images the views property for the particular image is incremented. However, I noticed when using Firefox (14....
11
votes
1
answer
74k
views
Increase the value of LimitRequestFieldSize in Apache
I have developed an application which uses a jQuery plugin, which in turn uses excessive cookie data. The problem is, after every 15-20 request I am shown this error message by the browser:
Your ...
1
vote
1
answer
2k
views
Is the following .htpasswd .htaccess login SSL protected?
I have a directory that I have protected using .htpasswd/.htaccess HTTP authentication.
In the .htaccess file for the directory I have this:
SSLRequireSSL
<Files .htaccess>
order allow,deny
...
34
votes
1
answer
94k
views
What is the name and location of the Nginx config file (htaccess equivalent)?
There are many tutorials on how to write Nginx rewrite rules to mimic Apache's .htaccess file but I can't confidently say I know what the name or location of this so-called Nginx config file actually ...
-1
votes
3
answers
332
views
How can a website recover from code injection especially the domain name?
My website was recently hacked that apparently it came under code injection vulnerability not SQL injection. At least that's what Google is telling me and even gave me a possible iframe codes. That ...
1
vote
1
answer
91
views
.htaccess RewiteRule Variable Issue
I am wanting to create redirect for urls using .htaccess
http://shows.example.com/showtitle/sitemap.xml
to map to my existing folder structure what is like
http://shows.example.com/sitemaps/...
2
votes
1
answer
793
views
HTTP 400: No Host matches server name for MS Office files on Apache Server
Background
We just migrated our website to a new server. Both the old and the new servers run/ran CentOS 5.5 and Apache 1.3.33. However, after the migration we have not been able to download any ...
0
votes
1
answer
844
views
Redirect directive ignored in .htaccess when using URL parameters
I have a default .htaccess file that comes with drupal. In order to redirect externally linked pages from the old website to the new one I usually use statements like
Redirect /foo http://www.example....
0
votes
1
answer
520
views
.htaccess to redirect all pages from domain to directory on same domain except root, /index.html, /index.php
I've searched and tried everything I've found and nothing seems to work quite right. What I'm trying to do is:
redirect all pages from a domain (domain.com) to a directory within
the same domain (...
0
votes
2
answers
7k
views
.htaccess - Too many redirects
I am getting a "too many redirects" error from the following two .htaccess files.
.htaccess on domain 1
Redirect 301 / http://www.domain2.com/
.htaccess on domain 2
RewriteEngine On
RewriteBase /
...
1
vote
1
answer
1k
views
Compress HTML using Apache
I'm using Apache to compress render HTML files but it's not working. Why? I'm usng hostmonster servers and YII PHP framework.
.htaccess:
<IfModule deflate_module>
AddOutputFilterByType DEFLATE ...
0
votes
4
answers
1k
views
403 Forbidden Access
Yesterday my supervisor mounted one of his directories onto my server. The problem is, I can't access them and I have no way of contacting him right now. When I type in the URL I get this error:
...
0
votes
1
answer
87
views
I am using mod_rewrite and am using a rewrite rule, is there a way for me to get the URL as seen in the address bar server side?
I can reconstruct the actual URL post rewrite rule, but is there a way for me to get the URL pre rewrite rule?
Also, when I run php in IIS 7.5, and have rewrite rules in my web.config, how do I get ...
0
votes
1
answer
592
views
Need help translating this htaccess rewrite rule to Nginx
Hi – I've been struggling with this for days. It seems simple but I just can't get it done.
I have a site developed in CakePHP. There's a script that responds to /css/profiles/g/whatever.css ("...
2
votes
8
answers
23k
views
Excluding a directory from a root .htaccess rewrite rule to allow it to be password protected?
I have spent a tremendous amount of time the last week trying to figure this out, but no matter what I try I cannot get this to work. My web host said they did not have anyone who knew enough about ....
1
vote
1
answer
557
views
Apache Hide Specific File Types from Web
I have a repository of files with .php, .sh, and .txt extensions which gets checked out to the web directory of my server (/var/www). I need the .php files to be able to be reached by typing in a url ...
1
vote
2
answers
723
views
How do I replicate my .htaccess functionality in NGINX
I have the below .htaccess file in apache that redirects all request to app/index.php with or without a GET parameter. I just installed NGINX and my application won't run.
Can anyone assist in ...
4
votes
2
answers
21k
views
Denying access to all files except index.html apache
Could someone help me with apache .htaccess file to deny access to all files and sub directories except for index.html on the documentroot for an apache server?
I tried:
<Location />
Order ...
0
votes
2
answers
396
views
nGinx non-www to www redirect
I have been working with apache for years and now wanted to move to nGinx keeping in view the performance everyone on internet seems to be talking about. But I its very frustrating for me for not ...
3
votes
1
answer
1k
views
htaccess email regex
I am trying to write a patter in such a way that this link :
http://www.mysite.com/link/go/[email protected]
is interpreted like this :
http://www.mysite.com/process.php?email=emailadress@gmail....
0
votes
1
answer
65
views
How to redirect requests to my URL to somefile.php not index.php
How can i redirect all the requests that are made to www.mysite.com to www.mysite.com/index_main.php and then rewrite www.mysite.com/index_main.php as www.mysite.com
0
votes
1
answer
49
views
Redirect to root is asked about a specific file
How can i redirect all requests to index_main.php to index.php through .htaccess?
5
votes
2
answers
28k
views
Why doesn't my htaccess redirect work?
I have setup a simple htaccess redirect which looks like this (this is the whole .htaccess file):
Options +FollowSymLinks
RewriteEngine On
Redirect 301 /something http://something.com/something.php
...