Questions tagged [.htaccess]

Directory-level configuration file found mostly on Apache web servers

Filter by
Sorted by
Tagged with
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/...
夏期劇場's user avatar
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 ...
david's user avatar
  • 1
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 ...
MB34's user avatar
  • 167
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$ ...
ijujym's user avatar
  • 131
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 ...
PHP Bugs's user avatar
  • 113
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}...
user avatar
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 ...
iLoch's user avatar
  • 201
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 ...
mahen3d's user avatar
  • 4,422
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","...
dasarath sahoo's user avatar
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 ...
Mahmood's user avatar
  • 11
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}...
Lothar_Grimpsenbacher's user avatar
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 ...
greatwitenorth's user avatar
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: <...
dasarath sahoo's user avatar
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: ...
giantforest's user avatar
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 ...
ᴍᴇʜᴏᴠ's user avatar
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 ...
user avatar
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 ...
Dany Khalife's user avatar
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....
user1595726's user avatar
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 ...
Jay's user avatar
  • 121
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 ...
Werulz's user avatar
  • 315
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://...
a coder's user avatar
  • 799
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 ...
kissgyorgy's user avatar
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. ...
chrisjlee's user avatar
  • 1,015
-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 ...
Shannon Matthews's user avatar
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'...
dotancohen's user avatar
  • 2,610
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 ....
dotancohen's user avatar
  • 2,610
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/~...
Darek's user avatar
  • 466
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....
Lee's user avatar
  • 73
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 ...
Ibrahim Azhar Armar's user avatar
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 ...
columbo's user avatar
  • 219
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 ...
tim peterson's user avatar
-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 ...
ThN's user avatar
  • 99
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/...
bertsisterwanda's user avatar
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 ...
Varun Vats's user avatar
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....
initall's user avatar
  • 2,365
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 (...
Ransom Grey's user avatar
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 / ...
Matthew S's user avatar
  • 199
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 ...
user avatar
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: ...
user avatar
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 ...
Robert Louis Murphy's user avatar
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 ("...
luchomolina's user avatar
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 ....
Nate's user avatar
  • 459
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 ...
hackartist's user avatar
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 ...
Bobby's user avatar
  • 11
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 ...
93196.93's user avatar
  • 291
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 ...
Nitin Srivastava's user avatar
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....
pollux1er's user avatar
  • 131
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
Amna Ahmed's user avatar
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?
Amna Ahmed's user avatar
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 ...
willdanceforfun's user avatar

1
34 35
36
37 38
57