.htaccess

using htaccess password protection on rails?

I want the /admin route on my rails app to be protected by using .htaccess password files - is this possible? ...

allowing index access only with .htaccess

Hello I have this in my .htaccess file, in the site root: Options -Indexes <directory ../.*> Deny from all </directory> <Files .htaccess> order allow,deny deny from all </Files> <Files index.php> Order allow,deny allow from all </Files> What I'm trying to achieve is to block folder and file access to anything that isn't called in...

Apache rewrite_mod: RewriteRule path and query string

I currently have a website with a standard web interface on index.php, and I made an iPhone-friendly version in iphone.php. Both pages handle the same arguments. It works fine when I manually go to .../iphone.php, but I'd like to rewrite anything on .../path/ and .../path/index.php to iphone.php if %{HTTP_USER_AGENT} contains mobile, an...

URL Rewrite problem

Hi, I did a .htaccess that change urls like www.site.com/sell.php to www.site.com/sell. Sell page exists at my / and it works fine. The problem is when i try something like www.site.com/sadasdasdasdadsdfgfds, because "sadasdasdasdadsdfgfds" doesn't exist. I receive a 500 Apache's error. This is my .htaccess file: RewriteEngine On Rewri...

Redirect old directory to new website

I want to use htaccess to redirect all traffic from www.oldsite.com/directory to www.newsite.com I want to make it so that when visitors view any webpage within www.oldsite.com/directory (ie. www.oldsite.com/directory/contact.html) it gets redirected to the homepage of www.newsite.com I tried "Redirect /directory http:www.newsite.com" ...

How to capture a 'sub-section' of a URL in a rewrite rule?

I know the title is a little bit strange, but here is what the URLs look like: /user/xxx/page /user/xxx/page?error=yyy The rule for the first URL looks something like this: RewriteRule ^user/(\d+)/page$ something.pl?id=$1 [L] And to make it work with the second URL, it becomes: RewriteRule ^user/(\d+)/page(error=\d+)?$ somet...

How come the [L] flag isn't working in my .htaccess file?

Here are the rules: <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^$ index.php?action=home [L] RewriteRule ^[\w\W]*$ error.php [L] When a page matches the first one, it is supposed to ignore any other further rules. Yet accessing / results in error.php being invoked. Commenting out the second rule works as intended - the page...

How to make a catch-all handler in an .htaccess file?

I want to create a rule at the end of an .htaccess file that catches everything that failed to match up until then. How can I do that? P.S. I've already tried everything :) Actually, I haven't, but it sure seems like it! Update: Some people are replying with RewriteRule ^.*$ or an equivalent. This does not work! It will match everythi...

404 page with file name query

How can I make a 404 php page with the 404'd file name in the link, example would be: http://website.com/WrongPageName.html would go to http://website.com/404.php?page=WrongPageName.html ...

mod_rewrite help can't get it to work

This is the first time I use mod_rewrite and I can't get it to work. I have a website with bands and their IDs. What I want: a URL /bands/My_Band_id13/ should redirect to /bands/index.php?bandname=My_Band&bandID=13 What I have: RewriteRule ^/bands/(.*)_id(.*)/$ /bands/index.php?bandname=$1&bandID=$2 What am I doing wrong? ...

Error headers: ap_headers_output_filter() after putting cache header in htaccess file

Receiving error: [debug] mod_headers.c(663): headers: ap_headers_output_filter() after I included this within the htaccess file: # 6 DAYS <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$"> Header set Cache-Control "max-age=518400, public" </FilesMatch> # 2 DAYS <FilesMatch "\.(xml|txt)$"> Header set Cache-Control "max-age=172...

Explanation for expires header

I have a joomla application working on Apache.To improve site performace we have written a .htaccess file to root of the application with setting a far future expires header to all the static content. As desired first time the files load in fresh with 200 status code. when again click on the same link many of the files are served directl...

change cat-art.php into cat/art.php

Hi i got a problem with changing urls. I have files: cat-art.php (cat- category, art- title of an article) and i would like to have nicer access to them: cat/art.php so i wrote some code in .htaccess but it doesnt work. RewriteCond %{REQUEST_URI} ^/([^-]+)/([^-]+).html$ RewriteRule ^([^-]+)/([^-]+).html$ $1-$2.html [L] Can sb help me...

IndexIgnore in .htaccess to hide directories instead of just files?

Is there an equivalent to IndexIgnore in .htaccess configuration for hiding specific directories (instead of just files)? http://httpd.apache.org/docs/2.0/mod/mod_autoindex.html#indexignore ...

changing the htaccess file in php

Hi, I want to change the maximum file upload size in my website, for this i'm going to add some code lines in my .htaccess file. i have searched in google and i got the lines of code to add in .htaccess file. But i don't know exactly were to add that lines of code . Below is the lines of code currently in my .htaccess file code below...

apache alias and .htacess willing to understand configuration?

On our local dev enviornment we had just one server and to add far future expires and cache control header to static images we kept a .htaccess file in the root of the application things worked fine. But on our prod we have multiple apache servers having aliases to a code base on a different server. Here in this case i am not sure where ...

.htaccess or PHP protection code against multiple speedy requests

Hi, I am looking for ideas for how I can stop external scripts connecting with my site. I'm looking for the same kind of idea behind Google. As in if a certain amount of requests are made per a certain amount of time then block the IP address or something. I thought there maybe a htaccess solution if not, I will write a PHP one. Any id...

RewriteCond simply doesn't work, doesn't check properly if file exists

Hey everybody. I've been trying to solve this for hours now but came up with nothing. Inside .htaccess, whenever somebody requests an image from a folder of my website, I'm trying to check if a file with the same name exists in another folder; if it does, return that file; if it doesn't, return the file originally requested. It seems ...

Writing .htaccess mod rewrite for hierarchical categories

i need to rewrite urls for my classified ads directory i have 4 types of links /City ==> display all ads in city /City/Cat1 ==> display all ads in city + category /City/Cat1/Cat2 ==> display add ads in city + category 1 + category 2 /City/Cat1/Cat2/Ad-id ==> display the ad itself and pass cat1 cat2 and city variables original hidd...

How to beautify the URL?

I am sick of this kind of URL: www.domain.com/something/?id=person&photos=photoID&variable1=others&... I am using apache, learning to write .htaccess now. Can anyone show me the basic code for this one? Ugly: www.domain.com/something/?id=person&photos=photoID Goal: www.domain.com/something/person/photoID ...