.htaccess

How to redirect to a certain page if no other RewriteRule is matched?

I have a bunch of RewriteRules in my .htaccess file and I wand to redirect to my custom 404 error page when no matching rules are found. I tried to: ErrorDocument 404 /index.php/index/error/filenotfound with no success :/ My custom error page URL is www.domain.com/index.php/index/error/filenotfound ...

CodeIgniter not working on PHP 4 server without .htaccess availability

Hi All, Basically i developed my app on a localhost wamp server with PHP 5. ON uploading to the actual host i notice that The server is running php 4.4.9 Everytime i upload my .htaccess file, the server removes it completely.. seems to not be allowed When i test out the set all i get is a 404 page not found Any help on how to make...

authenticate_or_request_with_http_basic doesn't resolve on host but works on local

I am trying to use a method like this: def authenticate authenticate_or_request_with_http_basic do |username, password| username == "user" && password == "pass" end When I have it on my local machine it resolves fine, but on my server it just keeps asking for the password. I saw the site http://railsforum.com/viewtopic.php?id=1459...

Setup Wordpress MU within an existing Wordpress MU

Hello, I have a current Wordpress MU site and I want to build a staging Wordpress MU within it. I have the staging setup on www.domain.com/staging. The problem is when I access the url above, It wont go to it. I have already played around with the .htaccess but don't still no success. Any suggestions would be a great help. Thanks! ...

htaccess: Custom redirect from any folder to home.

I have site with these files and foldes: /index.php ( that include php files contained in folder1 and folder2 ) /config.php /folder1/ /folder2/ I want this: when a user point to any folder ( folder1, folder2 or any other folder ) then he is redirected to index.php How could I do that ? ...

How do I enable mod_deflate for PHP files?

I have a Liquid Web VPS account, I've made sure that mod_deflate is installed and running/active. I used to gzip my css and js files via PHP, as well as my PHP files themselves... However, I'm now trying to do this via mod_deflate, and it seems to work fine for all files except for PHP files. (Txt files work fine, css, js, static HTML...

Clean URLs for static HTML files with .htaccess and mod_rewrite

Hello. mod_rewrite always baffles me... can anyone tell me the rules I need to get the following clean URLs? Desired URL on the left, real URL on the right. /our-work/ => /our-work.html /our-work/some-project/ => /our-work/some-project.html /contact/ => /contact.html As you can see, I want to force trailing slashes on all URLs too. T...

.htaccess rewrite include all url variables

I have a url that is rewritten using htaccess. The problem I'm running into is that some pages have a couple php get variables that aren't being included in the rewrite. Here is the code: Options +FollowSymlinks RewriteEngine on RewriteOptions MaxRedirects=10 RewriteRule ^(.*)$ http://www.domain.org/$1?l=es [P,R=301,L] Is it possibl...

the '.htaccess' file won't work on my apache server

Hi, I have an Apache server installed on my windows machine using XAMPP. Now I'm trying to use a premade .htaccess file for one of my projects, but it doesn't seem to be seeing it. The project just totally ignores it, even though I've enabled mod_rewrite. Any idea how I can troubleshoot this? I can't fix it if it just doesn't work and ...

htaccess mod rewrite changes http://www to http:/www

I want to replace calls like this: www.mysite.com/sub/file.php?param1=x&param2=http://www.someurl.com with: www.mysite.com/sub/param1/param2 Param 1 is an integer number Param 2 is a url I wrote this rewrite rule in htaccess: RewriteCond %{REQUEST_URI} \/sub\/ RewriteRule sub\/([0-9]+)\/(.*)$ sub\/file.php?param1=$2&param2=$1 [L]...

Convert Apache Htaccess rules to Lighttpd

Hi... I want to convert the following .htaccess rules to lighttpd. Can anyone please help me ? DirectoryIndex index.php RewriteEngine On #RewriteBase /your-sub-directory RewriteRule ^index.php/rewrite-test index.php/rewrite-pass [L] RewriteCond %{REQUEST_URI} ^(.*)//(.*)$ RewriteRule . %1/%2 [R=301,L] RewriteCond %{REQUEST_FILENAME} !-...

Is there a major downside to using .htaccess files in your svn/git repository?

If our .htaccess files are purely for mod rewrites, is there a security / development downside to committing .htaccess files alongside other files in your repository? For various reasons (our SEO optimisers like to add pretty urls as new promotions occur, etc) we need a fair few rewrite rules inside these files. Would I be better off pu...

Subdomain to folder htaccess

I am trying to point sub.domain.com to domain.com/app/*sub, but the farthest I can get is making it a redirection and I do not want it to redirect. Here is what I have, it works but it redirects it instead of staying on the subdomain, which is what I want. RewriteCond %{HTTP_HOST} ^(.*).example.com RewriteCond %{HTTP_HOST} !^www.exampl...

Access Rails under /app/, not /app/public/

I'm trying to deploy Rails 2.1.2 with Apache 2.2.10 and FastCGI (yeah, bad, ancient, ugly, I know). And I know it's no programming question, but please bear with me. My application can be accessed via example.com/app/public/, but I want to access it via example.com/app/. In my .htaccess-File (in the app/-directory!) I have: RewriteEng...

PHP or MySql error; Possible to display an "error page" in browser?

My classifieds website uses mainly PHP and MySql. On error, (for example if a variable isn't found), I would like to have an error-page to show, is this possible? And I mean for every error to point to the same error-page. I am thinking about htaccess, but maybe there are other ways also? Same with MySql, how is it done there? Thanks...

Subdomain and Uploadify not working

I have wildcard subdomains for example: .example.com goes to example.com/app/ It seems uploadify works fine if I use the directory instead of the subdomain. But when I use the subdoman and click on the upload image nothing happens. It seems to load the flash fine and no JS errors but when I click on the button I do not get a file brows...

How to use .htaccess to redirect to an url that includes a query parameter

Hi guys, I've been struggling with a redirect where the final URL includes a query parameter that is an URL. It seems htaccess is escaping some characters. Here is my htaccess: Code: RewriteRule ^mypath http s://www.otherserver.com/cookie?param1=123&redirectto=http://otherserver2.com/&param2=1 [L,R=302] First, if I put Code: h...

Joomla .htaccess problem

I am trying to rewrite from mysite.com/pokerbono/xyz to mysite.com/pokerbono.php?id=XYZ Here is the code I added in the .htaccess: #### Affiliate Links RewriteRule ^pokerbono/([a-zA-Z0-9_-]+)$ pokerbono.php?id=$1 [L] What is wrong with this rule? I tried like 100 variations and always receive a 404. I tried each and every ...

How can I allow only privledged users to download a pdf with php?

Lets say I have some pdf files stored on my server and I only want to allow a person who's paid have access to download a particular pdf. So for an example, let's say I have a bunch of e-books. The only way a user would be able to download e-book A is if his account contains the right credentials for that particular book. What's the b...

Is it possible to deploy a Ruby app on a plain clean Passenger setup?

I'm thinking to something really similar on what you can do with mod_php: drop an application in some way inside Apache and making it run with Passenger, without adding anything inside httpd.conf (no vhost, nothing except the basic Passenger configuration). It's something very similar to Wordpress or many other frameworks: just unzip/svn...