.htaccess

Kohana, .htaccess, and $_GET

After uploading my Kohana project to my Godaddy server, I noticed my standard .htaccess file wasn't working sufficiently to provide the clean URLs. After some guidance, I ended up with the following rule: RewriteRule .* index.php?kohana_uri=$0 [PT,L] This got my nice-URLs working again, but today I find out that it may be breaking my ...

How to search for a .htaccess file with Windows?

I am dealing with a massive nest of files and need to find a .htaccess file that is redirecting a single page in my website. I know how ridiculous this sounds: why not just check the directories the page is located within? But the problem is slightly more complicated than that. All I need though, is to search for every .htaccess file und...

Disable PHP in directory (including all sub-directories) with .htaccess

Hi all! I'm making a website which allows people to upload files, html pages, etc... Now I'm having a problem. I have a directory structure like this: -/USERS -/DEMO1 -/DEMO2 -/DEMO3 -/etc... (every user has his own direcory here) -index.php -control_panel.php -.htaccess Now I want to disable PHP, but enable Server-si...

.htaccess - redirect anchor link

I want: http://www.example.com/#test to be redirected to http://www.example.com/test With .htaccess, is that possible? How? ...

htaccess rewrite rule not loading site content

I am struggling with .htaccess rewrite rules. Let's say I have this URL. localhost/site/index.php and I want to rewrite it as this URL localhost/site/tutorial I would use this RewriteRule Options +FollowSymLinks RewriteEngine on RewriteRule ^tutorial/(.*)$ /up/index.php The page works, but the CSS files don't load. Also, if I ...

Redirect if File Exists in Subdirectory

I am trying to redirect to a subdirectory for files, but only if the file exists in the subdirectory. Essentially, its modeled like this: Does the file exist regularly? If so, display it. Does the file exist in the subdirectory? If so, redirect to it. If we're at this point, route into a dynamic script at index.php. The tough part ha...

weird htaccess question

Currently this is my .htaccess RewriteEngine on #rewrite the url's RewriteRule ^(.*)$ index.php?url=$1 [L,QSA] So, from the index i render a template, and give it a url. Normally a page would look like this www.whatever.com/?url=test/page But with the rewrite it goes www.whatever.com/test/page So the question is { I have an admin...

.htaccess file - modifying to allow scripting/plug-ins in a password protected directory

I have a directory in a website that the user has asked to password protect. Once I protected the directory, the webpages would no longer play the videos in the directory. The files use a plug-in from ProShow, and the have a file extension of (.px). At first I though it was the .js file that was being loaded from the ProShow website, but...

How to use SetEnv with a URL parameter

I'm trying to implement language switching in .htaccess, and the only thing left now is to handle clients which don't support cookies. To do that, I must set prefer-language when the user clicks a link with a language parameter. RewriteEngine On RewriteBase / RewriteCond %{QUERY_STRING} (?:^|&)language=(en|fr|no) RewriteRule ^(.*)$ $1?...

.htaccess allow localhost problem

Here is the situation... I have a cron job scheduled to run that is used to backup my database. Because of the way php is installed, I'm having to use lynx to hit the php script that is performing the backup. Because this script has to live within my public_html folder I want to deny all requests except for the ones that come directly ...

Create dynamic subdirectories using htaccess and php

Every single time a user registers on my site I would like them to have their own subdirectory with their registered "username". Every user subdirectory will have the same "index.php" file which will do something. For example: "/users/username1/" and "/users/username2/" If some one wants to access the subdirectory they would simple go ...

Problem with mod_rewrite rules in .htaccess file

This is my .htaccess file but it is not working. Not any URL is redirected. Help me. RewriteEngine on RewriteRule ^home index.php RewriteRule ^contactus index.php?file=c-contactus RewriteRule ^course_registration index.php?file=c-course_registration RewriteRule ^ncplhpage index.php?file=c-ncplhpage RewriteRule ^scplhpage index.php?file=...

Metatag keywords in htaccess?

Hello, I'm running a website with 3 domains redirecting to that domain (without a index file, just by admin panel at the provider). Is there a way to SEO these redirecting domains? When I was thinking about this I realized that by redirecting you probably can't upload a .htaccess because you don't have webspace. I think it's not possib...

how to use htaccess to disguise filetypes

I want to be able to name my files with whatever extension I choose. In this case let’s use .foo, and then process them as PHP files. Right now my .htaccess looks like this AddType application/x-httpd-php .foo But it doesn’t work, it still prompts me to download the file when I access it. Any advice or tips? ...

How can I protect a directory using .htaccess?

How can I protect a folder using .htaccess? I want the folder /files/myfiles to only be accessed by the server, not by a user? How can I do that? ...

Problem in image display using htaccess.

When I try to display image using image tag, there is problem to display image. For now images are in project/images/logo. The page where I am displaying image is in project/projectadmin/file.php. The image path is given as below http://localhost/project/images/logo/cat%5F149.jpg. When i remove htaccess, then no problem to display imag...

Can I use mod_rewrite to redirect to a URL with a zero-padded parameter?

I'm trying to use mod_rewrite to redirect URLs from a URL from an old host to a new one that uses a different URL format. The new host zero-pads the ID to six digits as follows: Old URL: http://www.example.com/script.cgi?page_id=123 Needs to redirect to: http://archive.example.com/000123/ This is what I have so far: RewriteCond %{...

Rewrite URLs to not include file extensions

Here's a recurring problem. There are similar questions on SO about this, but nothing quite answers my question. I've got a website and I want every page to be available at only one URL. It should work dynamically on all pages, not on a sinlge hard-coded filename. domain.tld/foo should redirect to domain.tld/foo/ domain.tld/foo.php sh...

htaccess problem.

I am not able to get URL redirection to work. It appears to be a problem with my .htaccess file. I am using WampServer. Following is the code in .htaccess: RewriteEngine on RewriteRule ^contactus index.php?file=c-contactus ...

Changing upload_max_filesize on a shared webhost? (Apache, PHP)

Hello! I want to change upload_max_filesize on my shared webhosting account to something greater than 2M. Since I don't have access to php.ini, and apparently you can't use ini_set to change upload_max_filesize, I don't know what to do. Maybe something involving .htaccess? Thanks! ...