.htaccess

URL rewriting for different protocols in .htaccess

Hello. I need help with url-rewriting in .htaccess. So the issue is about different protocols: https and http. The main purpose of rewriting is to remove "www" from URL, but protocol should stay the same it was before. For example, when I have URL like http://www.domain.com/request, it should be redirected to the http://domain.com/req...

.htaccess file is protecting all of my directories. How can I allow access to one?

I've got a folder on my server called dvd and I've put an index file in this folder. If i go directly to /dvd/index.html I can view the file. However, if I go only to /dvd/ I get a 403 forbidden error. I'm sure I can allow access to the /dvd/ folder but I can't figure out how. Below is the filesmatch code i'm using at the moment. Can som...

Rewrite rule to redirect html, but not any other files

I want my htaccess to redirect URL that end on ".html" to the index.php, but not any other files (so images can keep their href and still be displayed) This is how my htaccess looks like now, it works for the HTML redirect, but styles or images are not displayed (because they are also redirected, I guess) Options +FollowSymLinks Rewrit...

x-httpd-php5s <-- s!

I'm trying to replicate a web-site on a test-server. However, on the test-server, .php files don't get interpreted. I found that the cause is a .htaccess file in the document root. Its contents: # Use PHP5 Single php.ini as default AddHandler application/x-httpd-php5s .php RewriteEngine On #RewriteRule ^$ index.php [QSA] RewriteRule ^(....

Prevent executing .htaccess of parent folder

Hello I have two different sites on same domain for example: First site in the root directory http://example.com/ Second site in subfolder http://example.com/site2/ Each site have his own .htaccess When i enter to second site (http://example.com/site2/), in log of mod_rewrite i see that apache trying to execute .htaccess of first site (h...

& symbol encoded to %2526 in url

I need to replace the encoded value for the & sign in my url so the search query is successful. Im struggling to copy a similar method from the solution in this post for a query string such as below. lovelakedistrict.com/result/?q=Brookfield+Bed+%2526+Breakfast I want it to be like so lovelakedistrict.com/result/?q=Brookfield+Bed+&+Br...

Problem using .htaccess to replace characters in URL

Hi I've tried dozens of different ways of doing this but can't get any of them to work. My .htaccess does a few things, like setting a custom 404 and blocking image hotlinking. I want to do two things on the URL: add www. if it isn't there (rather annoying Facebook login can't cope with two different sources!), and replacing // with / e...

How Come Everybody Can See My Private Files?

Sorry for the newbie question... When I go to http://www.plans4boats.com/scripts/youtubeplayer/ in Google Chrome, I can see a full listing of the files there. What should I do if I don't want any old hacker to just come in and view/copy my source codes? Does it have something to do with htaccess? I discovered that putting a blank ind...

How do I get the [L] flag of RewriteRule (.htaccess) really working?

To newcomers: While trying to comprehensively describe my problem and phrase my questions I produced huge ammount of text. If you don't want to read the whole thing, my observations about (read "proof of") [L] flag not working the misconception, from which it all sprung, is located in Additional observations section. Why I misunderstood ...

How to Specify "Vary: Accept-Encoding" header in .htaccess

Google PageSpeed says I should "Specify a Vary: Accept-Encoding header" for JS and CSS. How do I do this in .htaccess? ...

.htaccess: How to "Specify a cache validator"?

I'm running Google PageSpeed on my site and it's tell me that I need to "Specify a cache validator." The following resources are missing a cache validator. Resources that do not specify a cache validator cannot be refreshed efficiently. Specify a Last-Modified or ETag header to enable cache validation for the following resources: ... t...

Hiding the get variables

I have a url that is constructed using get variables like location.href = this.href +'?type='+ escape($('#type_of_station').html()) + '&count='+ escape($('.number_changer').attr("id").slice(-1)); which gives me a url like the following http://posnation.com/pre_config/pre_config_step_2.php?type=Grocery&amp;count=2 on the following...

.htpasswd / .htaccess is letting *almost* any password work

I set up .htaccess / .htpassword and It works, except when I type the password incorrectly it still logs me in.. If I use a completely different password, doesn't work. A different user name, it doesn't work. But if I use the proper user name and mostly the right password, it works? Example: password I'm using is "firefight", and "fir...

Turning this string in modwrite

pre_config_step_2.php?type=Grocery&count=2 to /pre_config_step_2/Grocery/2 do i need to change the htaccess in the root directory and if so what do i change it to ...

Mod Rewrite Producing 404 When Crawled (works fine when viewed in browser)

I have the following code in my .htaccess: RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] My pretty-link converting is done on my index.php. If the user is looking for something that doesn't exist, a 404 Header is produc...

.htaccess url rewriting with php

Hello there everyone. I currently have an entire website running on PHP & GET variables. My links look like this at present http://www.example.co.uk/brochure.php?cat_path=24 And occasionally it has a second variable in the url... I actually would like my URLs to look like this: http://www.example.co.uk/Concrete_Fence_Posts So...

help with setup of .htaccess file redirects

Hi .htaccess ninjas, I need help configuring my .htaccess file to handle redirects properly. Here’s what I need to have happen. Stackoverflow's spam filter wouldn't allow me to post the full domain. So where I say "DOMAIN" you can substitue "domain.com". (I also needed to add and extra t to the http.) Requests for the DOMAIN/page ve...

Define php.ini path with .htaccess inside a Wordpress theme to change upload_file_size?

I having a wordpress blog. I made a custom page-template that allows users to upload files to my server. Just a simple php script which connects to my server with a form to select a file, blabla.. you know! However the upload-feature doesn't make any sense with a max_upload_filesize of 20mb. Now i want to change that. According to my h...

Allow IP address without authentication

I have set up a site that is currently work in progress. I'm using an external SMS gateway that needs access to a script on my server. However, I have set up a basic username and password authentication for regular users, but the SMS gateway can't get through that. How can I allow a single IP to pass through the authentication without a...

htaccess and htpassword

hi I am using htaccess and htpassword file in my project. Everything is working fine but when I put an encrypted password in the htpassword file then password does not match, but when I put in a plain text password it does match. But I want to match the encrypted password. Please tell me what the the problem is and how I can resolve th...