.htaccess

A short "RewriteRule" regexp question

I have a very very long querystring which ALWAYS starts like this: mydomain.com/bincgi/sql_query.php?alot alot alot of variables passed along What is the regular expression to make a rewriteRule if I want to pass along all the variables but via this link: mydomain.com/search/all variables here instead..... So the last one is wh...

url rewrite, login problem in particular pages, no response headers

Recently, I was doing .htaccess url rewrite, make all my php url into html, in some page, the logout button wont work properly. for example, in page ‘quotedetails/Q9999.html’ (rewrited from ‘quotedetails.php?quoteID=Q9999′), when I click logout button in this page, it wont do the trick, but when i use the old php url of this page, it wor...

htaccess - rewrite rule issue - not able to get 10th variable

I am not able to get the 10th variable. I am getting 1st variable appended with a 0(zero) instead. RewriteRule ^(browse_by_exam)/(classes|packs|tutor_search)/([a-zA-Z0-9\.\á\á\â\ä\ã\å\æ\ç\è\é\ê\ë\ì\í\ï\ð\ñ\ò\ó\ô\õ\ö\ø\ù\ú\û\ü\ý\þ\¿\¡\«\»\ÿ\ß\$\*\!\-\=\@\#\%\^\(\)\_\&\{\}\;\,\<\>\?\`\~\[\|\"\'\]\\\ +]+)/([0-1])/([0-9]+)/([0-9]+)/([0-9]+)...

PHP: Inhibit AddOutputFilterByType .htaccess option

Hi, in the root directory of my webapp, the .htaccess file contains the following line: AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css application/x-javascript text/javascript This means that all my pages are gzipped, and it's ok. In some pages I need to make the browser close the connection before the script en...

htaccess rule redirect non www to www - litespeed server

I have a question about using htaccess in my litespeed server. I tried to redirect http://domain.com to http://www.domain.com using this rule: Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{HTTP_HOST} ^domain\.com$ [NC] RewriteRule .* http://www.domain.com/ [L,R=301] When I check http://dom...

Redirect Using htaccess

I am trying to redirect /folder to / using .htaccess but all am I getting is the Apache HTTP Server Test Page. My root directory looks like this: / .htaccess -/folder -/folder2 -/folder3 My .htaccess looks like this: RewriteEngine On RewriteCond %{REQUEST_URI} !^/folder/ RewriteRule ^(.*)$ folder/$1 [L] What am I doing wrong? I che...

How do you limit access to a site by geographical location?

Hi. I need to come up with a way to limit users' access to a page to IP addresses within North Carolina. This has to do with usage rights for some MP3 audio. Are there companies that provide this service or is there a list of IP address ranges for a geographical location? This is on a Unix, JBoss/Seam environment. Thanks. ...

Removing special chars from URL with .htaccess

Hi all, I'm trying to use urls on my site like example.com/@lorem-ipsum-dolor instead of example.com/tag/lorem-ipsum-dolor form. It's working on my local and remote servers, but if urls contains " : \ * | etc chars it's not working on local server (Win XP). Is there any solution? If not, then I think I need to remove that chars from ...

RewriteCond to change displayed host, but not server

Typing out the title to this leads me to believe this might not be possible due to security concerns, but I will ask anyway. I have shortcode support running on my server, lets call it xx.yy I want it so when a user sends a request to xx.yy, it just changes the displayed host to another valid domain running on the same box. I have thi...

Rewriting URLs with mod_rewrite

Hey guys, I'm currently rewriting urls from http://domain.com/profile/?u=10000017564881 this to this http://domain.com/profile/10000017564881 with the following rewrite RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*?)\/?$ index.php?u=$1 [L] However I'd like to optimiz...

.htaccess rewrite rule to add a string in the middle of the URL

Using a .htaccess rewrite rule, I need to add "?q=" before the path on any URL's containing the word "imagecache" Therefore, if the URL is: http://mysite.com/sites/default/files/imagecache/myimage.jpg ...then it will really try: http://mysite.com/?q=sites/default/files/imagecache/myimage.jpg But that will ONLY happen if the URL c...

What's right for me: htAccess, form submittion, HTTP header authentication w/ PHP?

I am creating a website with multiple sections--admin, client, user, and anonymous--each user group having less access then the next. I am wondering what form of authentication would be best for my use? I have heard the if you are just dealing with a websites then a web form is for you (because it's prettier). HTTP header authentication...

using htaccess to redirect certain requests to a php file along with variables

Im trying to find how to take a page request such as http://www.domain.com/sam/?dog=woof&amp;cat=meow and send it to http://www.domain.com/animals.php?dog=woof&amp;cat=meow Ive tried a few things ive found on here, or i adapted them i should say, but i keep getting either nothing, or infinite loops. Any ideas? UPDATE this is the htac...

Rewrite URL if file exists

I need to redirect web requests of the form /{language}-{country}/{file} to: /{language}-{country}/{file} if it exists, otherwise /{language}/{file} if it exists, otherwise /en-US/{file} The existing .htaccess fulfils requirements 1 and 3. What changes do I need to fulfil requirement 2? .htaccess: Options +FollowSymLinks RewriteEng...

can some one give me a sample gzip code for htaccess?

I'm keen to get started experimenting with gzip, but like i used to find php.net when i first started learning php, the apache documentation confuses me a bit. http://httpd.apache.org/docs/2.0/mod/mod_deflate.html I'd really appreciate a sample htaccess file to have a look at if anyone's got one? Also are there things which should be c...

modify REQUEST_URI in .htaccess

I want server side script to see modified uri instead of the uri that was typed in browser. Just like in the following example: RewriteCond %{REQUEST_URI} (.*)abcdef$ RewriteRule ^(.*)$ /test/ [L] But the server side script still sees abcdef Is it possible to modify REQUEST_URI literally? ...

.htaccess redirect folders

Hello I have a link on my site with files at the following link: example.com/community/community/ How can I use htaccess to convert the link to example.com/community/ without moving the files from /community/community/ ...

Selective SSL with .htaccess force http:// or https://

I am trying to be more selective in which pages/requests are using SSL for performance reasons. I would like to use htaccess to redirect to https:// for only the required pages and redirect back to http:// for everything else. This is what I have: RewriteEngine On # force https RewriteCond %{SERVER_PORT} !^443$ RewriteRule ^(.*)/(abc|x...

Is a htaccess file different on apache running on a windows server

Hello, I am building a website on a windows server running apache and need to use a .htaccess file for pretty urls. If I add the .htaccess file it is just ignored, do I need to use somehting else? Is a .htaccess ignored on a windows server? Thank you for the help. ...

Rewriting subdomain to subfolder with htaccess

I'm attempting to use .htaccess in the root folder of an Ubuntu/Apache2 server in order to mask a subdomain to subfolder and I keep getting a 500 Internal Error. I know that I'm doing something stupidly wrong and it is some silly error causing the problem. I've checked all of the similar threads on SO and online and whenever I try their ...