.htaccess

.htaccess for compression, browser caching, proxy caching, etc.

Can someone provide me with an optimize .htaccess configuration that handles compression, browser caching, proxy caching, etc. for a typical website? Aside from my visitors, I'm also trying to make Google PageSpeed happy. ...

.htacess windows problem

Hi, In the root directory of a small site i'm developing i have the following .htacess file: Options +FollowSymLinks RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-F RewriteRule .$ index.php that basically allows me to have pretty urls as it remaps every path that does not exists on the server (eg : /user/details/145 ) as a call ...

Is any otherway to run .htaccess file in local server?

Is anyway to run .htaccess file in local server without using online? ...

404 Not Found When Requesting URI With Encoded Patameters

I am pretty sure this is some problem with the Apache configuration because it used to work on the previous hosting provider with the same PHP/MySQL configuration. In my application, users are able to delete photos by going to URIs like this: http://example.com/my-account/remove-media/id/9/ret/my-account%252Fedit-album%252Fid%252F1 Th...

How can I use mod_rewrite to redirect children pages/directories to a parent directory?

So I have a whole series of redirects in place for a bunch of pages I want redirected to their parent directory (e.g. /faq/question1/ -> /faq/), but it's very inflexible, as they're manually generated. How can I set up a RegEx-fueled RewriteRule for this? I haven't been able to figure it out, and would dearly love some guidance. Here's ...

.htaccess makes php files downloadable

I have an .htaccess file with following content: AddHandler x-httpd-php5 .php For some reason, whenever I upload it to the server, Firefox then wants to download PHP files instead of showing them, I think the Apache server has some error. What's wrong? Thanks in advance ^^ ...

htaccess redirect conditions

I figured out how to redirect someone, if they happen across one particular filename: Redirect /index.php http://www.website.com/#myaccount As you can see, I'm pretty much redirecting that visitor to the same page, which doesn't work. It's an endless look, regardless of the slight/minuscule change. I want to force someone to see a pa...

General RewriteRule for many undefined parameters in URL

I'm trying to write a rule to make that one can generalize, since multiple pages to pass the values are different. Right now I could do: RewriteRule ^forum/([^/]{1,255})/([\+]{1})/((([a-z]+)([_]{1})([a-zA-Z0-9]+)([/]?))+)$ forum.php?name=$1&$5=$7 [L] To address such as: Nome+del+Forum/+/page_1/action_do Should return: forum.php?...

Hide index.php from web site URL

Hi, I'm using htaccess rewrite engine to make urls look nice, from www.mysite.com/index.php?pag=home to www.mysite.com/pag/home it works fine with this rule RewriteRule ^pag/([^/]+)$ index.php?pag=$1 [L,QSA,NC] but when I go to www.mysite.com it redirects me to www.mysite.com/index.php is there a way to redirect to www.mysite.com/p...

Apache mod_rewrite - prefer files over directories with pretty URLs

I want to have pretty urls so http://www.domain.com/foo will return http://www.domain.com/foo.php The issue is that there is a directory that has the same name. I have another page at http://www.domain.com/foo/bar/baz and right now my server just returns the directory listing of foo when I request http://www.domain.com/foo Pseudocode: ...

how to log incorrect entries (php .htaccess)

Hey there, I have created an .htaccess files that will prevent anyone from accessing a file unless he has a username and a password, how can I log files when anyone tries to access with incorrect information and then ban the Ip address. I know it in php but .htaccess i am still new to it. Thank you everyone. ...

htaccess mod rewrite files to go through php first?

I have a directory full of files. Originally people were allowed to direct link to these files. Now i would like to run all files through a php file first. Could someone help me with the .htaccess needed to do that? The phpfile used to handle the downloads will be called download.php and it will have a get variable called $ref So i ne...

Protect Apache server

My server is attacked like this 188.165.198.65 ./../../../../../../../../../etc/passwd%00 HTTP/1.1" 200 28114 "-" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 1" How can I defend it with .htaccess file? ...

Wordpress htaccess in root overriding htaccess in subdomain. Subdomain app not working now.

Hello, We have a WP install in the root of our server and its running great.. but, we just installed another app in a subdomain. Now, I can view the index.php of that app but cannot do anything with it.. the htaccess rules in the root (from WP base install) are effecting the requests. So, how to I eliminate the WP htaccess file from eff...

Implementation problem. Htaccess in php

I have a problem to fix the URL on my website at http://www.abelputra.com I need a solution: I want to change www.abelputra.com/software.php into www.abelputra.com/software I have read a tutorial like this: For .htaccess: RewriteEngine On RewriteRule ^ ([a-zA-Z0-9_-] +) $ index.php? Key = $ 1 RewriteRule ^ ([a-zA-Z0-9_-]+)/$ index.php...

Make subfolder the root folder for everything in subfolder

Hi there. I am working on a project that i host on my server. My server is mydomain.com and i want my project to run in mydomain.com/project. I wish to put an htaccess file in the project subfolder, so that in every file of the project, / will point to mydomain.com/project instead of mydomain.com So / will be mydomain/project, /lib/im...

Problems with Routing URLs using CGI and Bottle.py

I've been having difficulty getting anything more than a simple index / to return correctly using bottle.py in a CGI environment. When I try to return /hello I get a 404 response. However, if I request /index.py/hello import bottle from bottle import route @route('/') def index(): return 'Index' @route('/hello') def hello(): ...

How do I block curl downloading of a specific page?

I read that spammers may be downloading a specific registration page on my site using curl. Is there any way to block that specific page from being CURLed, either through htaccess or other means? ...

htaccess mod rewrite NOT

Hi, I have a small problem with url rewriting on apache. I would like it that it ignores the admin/ folder from rewriting. Options +FollowSymLinks RewriteRule ^([^/]*)/([^/]*)\.html$ /index.php?cat=$1&name=$2 [L] RewriteRule ^([^/]*)/$ /index.php?cat=$1 [L] I have triend doing it myself but I can't figure it out. Thanks. ...

mod rewrite escape chars

hi, simple question, my url is www.site.com/page--3 I need the rewriterule to read "/page--3" as two different values. I have this working: RewriteRule ^/?([a-zA-Z0-9-]+)/([a-zA-Z0-9-]+)$ index.php?page=$1&subpage=$2 This gives me the values 'page' and '3' from www.site.com/page/3. how do i get the rewriterule to read the '--' as ...