.htaccess

.htaccess mod_rewrite problems

I just recently ported over my source code to Ubuntu Server from Windows and I've been having a few .htaccess mod_rewrite problems. I have mod_rewrite enabled for Apache. Here is my current .htaccess RewriteEngine On RewriteRule ^css/default/?$ css/default.css RewriteRule ^user/?$ user.php RewriteRule ^user/([A-Za-z0-9_]+)/?$ user.ph...

How to modify .htaccess so that it points to a sub-folder in codeigniter

Codeinginter provide .htaccess file as explained below. It is from CI User Guide. However when I add this file in xampp/htdocs/mycodeigniter, and point to http://127.0.0.1/mycodeigniter/somepage, it goes to http://127.0.0.1/xampp which is the root file in htdocs. How can I fix the file so that it points to http://127.0.0.1/mycodeignite...

.htaccess Redirect request to files exts in particular folder only

Hi. How do you write rules to redirect all requests to *.php and *.html files in upload/ folder to a text file name forbidden.txt in root www folder. What I'm trying to do exactly is preventing script execution in this dir by redirecting those requests to the text file Note: The upload/ folder is accessibly by ftp used by a group of peo...

.htaccess mod_rewrite problem - shot myself in the foot?

I have a page called category.php5 that uses $_GET["category"] to fetch the right content from the database. I want to pretty it up so is looks like: sinaesthesia.co.uk/category/psoriasis which would equal: sinaesthesia.co.uk/category.php5?category=psoriasis I have successfully done this sort of rewriting before, but since I can't ge...

Sub-domain as variable in mod_rewrite

I am trying to mod-rewrite based on a sub-domain. How do I take the subdomain and append it to the end of my new domain? Example: RewriteCond %{HTTP_HOST} ^users\.example\.com$ RewriteRule ^(.*)$ http://www.example.com/?subdomain=[variable for sub] [L] How do I get 'users' into [variable for sub]? ...

mod_rewrite complexity problem

I have a need to mod-rewrite my domain based off of subdomains...there are two scenarios in which i would need to do this: my site is located in different cities...so losangeles.example.com should localized to los angeles, etc...essentially rewritten to www.example.com/?loc=losangeles i want to allow users to create username.example.co...

IE 7 not showing my custom 401 page

I created a 401 page, which is html, and within an accessible directory. It displays in IE 6, Firefox, Safari, but not IE 7. Here is the .htaccess file for setting the authentication on the directory and location for the 401 page. KrbServiceName HTTP KrbMethodNegotiate On KrbMethodK5Passwd On #KrbVerifyKDC on KrbSaveCredentials off Kr...

How do I prevent access to a set of folders, but allow access to images in a subfolder of one of the folders (with .htaccess)?

Hi. In my root web folder I have a list of folders (files, modules, classes) that I'm using .htaccess to prevent access to. However, in the modules/ folder, there are modules that carry their own images, which I'd like to allow access to. How do I allow access to images in a folder under modules/, but still prevent accessing any other ...

htaccess rewrite turn all "folders" into request variables, almost got it!

Here's what I have now: Options +FollowSymlinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]+)/([^/]+)(.*)$ /$3?$1=$2 [N,QSA] This turns www.any.com/x/20/y/30 into www.any.com/index.php?x=20&y=30 (while ignoring existing directories - thank you so much Gumbo!!) RewriteRul...

Still having mod_rewrite problems / .htaccess

I have several rewrite rules in my .htaccess file that all work fine and I want to add a specific case to turn sinaesthesia.co.uk/category/psoriasis into sinaesthesia.co.uk/category.php5?category=psoriasis So I tried: RewriteRule ^(.)category/(.)$ /$1category.php5?category=$2 [L] which doesn't work. I've tried it without capturing...

Under what situation will .htaccess not work for Apache?

vi .htaccess: RewriteEngine on RewriteCond $1 !^(index\.php|audio|editor|upload|images|js|css|robots\.txt|sitemap\.xml) RewriteRule ^(.*)$ /index.php?$1 [L] When I try to browse http://wolaitiao.cn/install,it reports 404,so it's not working correctly. Is it because it's a VirtualHost? <VirtualHost *:80> ... ...

Serve .ICS files as binaries purely through .htaccess or apache conf

When I upload an .ICS file to the server and try to download it, it appears as text. I would like the "Save as" dialog to appear so that the user can open the file as a binary in Outlook. What can I put into the apache conf or .htaccess rule to make the headers for ICS files work like a binary. Example: A .doc file opens like a binary...

Exclude specific subdirectory from mod_rewrite rule

I currently have: RewriteRule ^scripts/(.*\.js) /combine.php?type=javascript&files=$1 Current scripts folder looks like: scripts/ folder1 f1.css folder2 f2.css folder3 f3.css bespoke bespoke.css css.ss I would like this rule to exclude anything within the scripts/bespoke/ folder. ...

Rewrite index.php in Wordpress

I started a blog and when I changed my permalink structure to /%postname%/ I get a Page Not Found error. I want my url to look like this: http://bobbybeckner.com/sharepoint-list-and-linq-using-jquery-and-ihttphandler/ not this: http://bobbybeckner.com/index.php/sharepoint-list-and-linq-using-jquery-and-ihttphandler/ I read a few pos...

Using mod_rewrite to strip certain GET variables

I'm a mod_rewrite noob and I'm getting a headache trying to figure out something that should be simple. What I'm trying to do is strip out unwanted variables from a URL displayed after a GET form is used. In other words, I'm trying to change this: stats.php?gender=W&team_id=88&btnGet=Get+Stats to this: stats.php?team_id=88 Please...

Password protecting AutoIndex but not static files with .htaccess

I have publicly accessible files on my webserver. I'd like to enable AutoIndexing (Options +Indexes) but I'd like to require a password in order to view these listings. I have no problem setting up the Auth but there are complications with the public files and the DirectoryIndex files in that if someone also asks for a directory, and t...

Using an SSL certificate with .htaccess rewrite

I'm wondering, if I have an .htaccess rewrite setup on a virtual subdomain, ie. bm.example.com that has a rewrite to www.example.com/index.php?u=someId and I have an SSL certificate on www.example.com, will I run into problems if I try and access https://bm.example.com? ...

creating virtual sets of unique images from a folder of images

I have a folder full of 2000 images, all unique and named like this: /images/0001.jpg (... 2000.jpg) I need to be able to access 100 random, unique images. Something like this: /sets/0001/001.jpg (... 100.jpg) I need hundreds of "sets of unique images" like this. I made one example set using a folder and a htaccess file with 100 lin...

htaccess 301 redirect dynamic url

I am moving my site to new domain. Need to redirect pages from old-site.com/oldpage.php?id=X to new-site.com/newpage-X (X is number) Why this rule does not work? RewriteEngine on RewriteRule ^oldpage.php?id=(.*)$ http://new-site.com/newpage-$1 [R=301,L] ...

How do I rewrite URLs using htaccess?

How can I rewrite the following URL: http://www.myurl.com/job/Accounting-Clerk-at-Department-of-Workforce-Services-in-Salt-Lake-City,-UT-1b6117567108f5a2 Into these components: query = Accounting Clerk; cmp = Department of Workforce Services; location = Salt Lake City, UT; key = 1b6117567108f5a2; To get this result: index.php?q=$q...