.htaccess

Ruby on Rails cPanel Mongrel config

Hi All, I've setup my rails app in ~/rails_apps/testapp. I've got it running on port 12004 (there are some issues with mongrel, but i've got it running now so that's sorted i believe). I've set up the following in my ~/public_html/.htaccess file: RewriteEngine On RewriteCond %{HTTP_HOST} ^mysite.com.au$ [OR] RewriteCond %{HTTP_HOST} ...

Htaccess RewriteRule trouble - How to redirect to a "re-written" url on the server?

I have the following rewrite rule which is working fine: RewriteRule ^([a-zA-Z\-]+)[/]?$ apply/?survey_folder=$1 which turns this: address.com/folder1/ into this: address.com/apply/?survey_folder=folder1 The problem is that I can't figure out a way to use a redirect to the rewritten URL. Using cfml as an example, (cflocation url="htt...

Set up HTACCESS to exclude rewiting urls of a certain folder

Hi guys I have an htaccess file setup as below which translates url parameters into easy to ready urls i.e index.php?customer=2 becomes index/customer/2 RewriteEngine on RewriteCond %{HTTP_HOST} ^fltdata.com [NC] RewriteRule (.*) http://www.fltdata.com/$1 [L,R=301] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule .* index.php RewriteRu...

Cache Control Question

If I set this for cache control on my site: Header unset Pragma FileETag None Header unset ETag # 1 YEAR <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4)$"> Header set Cache-Control "public" Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT" Header unset Last-Modified </FilesMatch> # 2 HOURS <FilesMatch "\.(html|htm|xml|txt|x...

mod_rewrite and htaccess question

How should my .htaccess file look like if I want the following conditions to be met: if page requested is /webcam/* then actually show /show.php and if page requested is /tag/* then actually show /tag.php when searching on google for this, i only found how to meet one condition, but not two together. Thanks, ...

cakephp .htacccess with multiple domains

I have my cakephp .htaccess files set up as in the cookbook and everything is working fine. My web site currently has multiple domains, all of which point to the same site (e.g. www.site.com, www.site.co.uk). I'd like to set up a rule so that requests to www.site.co.uk/page are permanently redirected to www.site.com/page, etc. I'm havi...

.htaccess to change URL

So i have a mvc system setup but it does not generate search engine friendly urls. A typical url is in the format: http://sitedomain.com/class/classMethod?parameter=valueA?parameter2=valueB This is what i need to have: http://sitedomain.com/class/valueA/valueB/ My .htaccess actually modified a part of the url already but i dont kn...

Is there a more efficient way to code this .htaccess file?

Is there a more efficient way to code the .htaccess file I have included below? Also, is the order of all the different elements ok? One user described the file as the "bushiest" htaccess he had ever seen, so I want to learn how I can make it better. Thanks in advance! <FilesMatch "(phpinfo|configurations).php$"> AuthName "Restrict...

htaccess redirect according to IP

Let's say my server looks like this: /www/.htaccess /www/index.php /www/temp/index.php And my personal IP (not the server's!) is 127.0.0.1* (* ok, that's impossible, but for the sake of argument...) I would like to redirect (301/302) everyone EXCEPT that IP to /temp/index.php My current code looks like: Options +FollowSymlinks Rewr...

Why is my .htaccess code slowing down my site?

Hi all, I have a quick question about .htaccess. Why does my site load faster when using this URL: http://www.phaidi.com/network/index.php?p=home&amp;s=chaumyvn Than by going straight to the chaumy.vn domain? I think it has something to do with my .htaccess, but I have not been able to fix it. See my .htaccess file below: Options +F...

htaccess code to set QSA for all redirects automatically (globally)

Firstly, this is the current setup, so that you understand where I am at the moment... If I go this url: http://website.com/login/ The server redirects to this script: http://website.com/page.php?section=login I have the follow htaccess redirect set up to do this: RewriteRule ^([a-zA-Z0-9_]*)/$ page.php?section=$1 [QSA] That my...

Slow loading a site on godaddy.com (linux host)

Hi all, I have a site with a subdomain say www.foo.com with abc.foo.com as a subdomain. When accessing the subdomain it would take ages to load. I then checked and disabled .htaccess in the root and then it seems to load quite quickly. All i have in my .htaccess is, ErrorDocument 403 /error-docs/403.shtml ErrorDocument 404 /error-docs...

mod_rewrite local redirect on hostname

Hi, wonder if you can help me, I've got a hosting account (on GoDaddy for my sins) which has one domain name associated with it and a few more parked. If I visit: site1.com site2.com site3.com I get the contents of /httpdocs/ I want to redirect to a sub directory (locally) only so that if you goto site2.com, the URL stays as site2....

How do I redirect to domain name without the trailing /

Currently, if I go to my site... example.com OR example.com/index.php ...I am redirected to... example.com/ However, I would like to stop the addition of the training / when visiting the main page. The following is my htaccess file... IndexIgnore * ErrorDocument 400 /error ErrorDocument 401 /error ErrorDocument 4...

.htaccess multiple authorization for sub-child directories

I'm looking to edit my .htaccess file to control AuthTypeBasic for it's own directory and child directories differently. I currently have password protection (AuthType Basic) set up on the a folder and would like to set up some of the children directories to be exempt from this password protection and other child directories to have uni...

htaccess RewriteRule redirecting unexpectedly www

In my htaccess I have a rule - I have this rule RewriteRule ^mk$ http://mysite.com/mypage.php [r=301,nc] and later on : RewriteCond %{HTTP_HOST} !^mysite\.com$ [NC] RewriteRule ^(.*)$ http://mysite.com/$1 [QSA,L,R=301] This works fine for http://mysite.com/mk - it redirects to: http://mysite.com/mypage.php as I wanted. ...bu...

How do I get google to display my link as example.com NOT example.com/

Currently google shows my site link as... example.com/ ...however, I would like it to be displayed as... example.com I do have the following meta data <link rel="canonical" href="http://example.com" /> ...and the following is my htaccess file... IndexIgnore * ErrorDocument 400 /error ErrorDocument 401 /error ErrorDocument ...

allow directory listing from local hosts .htaccess

i have a files directory on my local web server and i want to make it so that only local users can view the directory list. for example if a friend visits the site from his house, he should not be able to see site.com/files/ but can get the file site.com/files/image.png. for local users i want them to be able to do both. i tried the foll...

Apache URL Rewrite Question about File Which doesn't Exists

I have folder which path is .com/yp/uploads and i have another folder .com/uploads I want to do htaccess rule like this: If .com/yp/uploads/abc.jpg(or another file extension) doesn't exists then show .com/uploads/abc.jpg Thank you. ...

.htaccess 404 errorDocument problem

I have this in my htaccess: Options +FollowSymLinks Options -Indexes RewriteEngine On RewriteRule ^annons/([a-zA-Z0-9_]+)$ ad.php?ad_id=$1 [NC] ErrorDocument 404 /404.html This all works, except for one problem. When I write an adress that doesn't exist like this: http://www.domain.com/some_adress_that_doesnt_exist then the 404...