Skip to content
Advertisement

Tag: .htaccess

store constant variable on server via .htaccess

I would like to store the INDEX_URL constant the easiest way possible. There is a developer site and a normal site. If there is any change on the developer site, I would like to just copy the entire files but this constant is not the same on the 2 sites. I have made this test: It seems it does not

Custom Error 403 Page PHP

I created a .htaccess inside a directory in which I don’t want the files to be directly accessed. It works and fires the default 403 page (Access forbidden!) of the Apache server. How can I create a custom 403 page? Thanks! Answer In your .htaccess file you can specify what document you want as your default 403 error document. Here

Altering .htaccess with PHP – removing a rewrite rule

I am using PHP to remove/add static pages once a page has been deleted, I want to be able to remove it from the .htaccess, however I’ve tried this, but it throws an error: Warning: preg_replace() [function.preg-replace]: Unknown modifier ” in … The code: This is an example of what it should fully remove: Answer You have to escape the

htaccess access to file by ip range

How to allow access to file only to users with ip which are in a range of ip addresses? For example file admin.php. and range from 0.0.0.0 to 1.2.3.4. I need configure access to only ONE file not to directory. Answer Just add a FilesMatch or Files directive to limit it to a specific script. The following would block acces

How to enable gzip?

I have found a couple of tutorials on how to enable gzip, but nothing seems to be working for me, so my question is how do i enable gzip. I am on a shared Dreamhost hosting server, It is running PHP …

How to redirect subdomain to main domain maintaining the same URL?

My main domain(www.mysite.com) is pointing to a folder in my server (/home/user_name/htdocs/mysite.com). I have recently created a subdomain(m.mysite.com) through my hosting account. But it is pointing it to a new folder (/home/user_name/htdocs/m.mysite.com) in my server. I am not able to edit the path to which this new subdomain points to. All my files are hosted in my main folder path.

.htaccess deny access to specific files? more than one

I am able to disable access to a file with .htaccess, but I don’t know how to disallow multiple files to be viewed (directly, not from includes) They are .php so I can’t disable a file type (like the only tutorials online say..) Or something.. For example “home.php, file.php , test.php” how do I disallow access to all three files

.htaccess 301 redirect of single page

After a site redesign, I’ve got a couple of pages that need to be redirected. Everything is staying on the same domain, just a couple of things have been reorganised and/or renamed. They are of the form: /contact.php is now: /contact-us.php Using the .htaccess file, I’ve added this line, which is the one I find recommended most: This is mostly

.htaccess files, PHP, includes directories, and windows XAMPP configuration nightmare

XAMPP makes configuring a local LAMP stack for windows a breeze. So it’s quite disappointing that enabling .htaccess files is such a nightmare. My problem: I’ve got a PHP application that requires apache/php to search for an /includes/ directory contained within the application. To do this, .htaccess files must be allowed in Apache and the .htaccess file must specify exactly

Advertisement