.htaccess

'+' symbol in htaccess

I am using htaccess. I try to pass a value in url like 'C++'. like "http://domain.com/Details/c++/detail.html" I am retrieving the value in htaccess like RewriteRule ^Details/([a-zA-Z_0-9_.,'&/-]+)/(([a-zA-Z_0-9_.,'&/-]+).html)$ index.php?page=$2&id=$1 But it returns only 'c'. Symbol '+' not accepted. I need the the value 'c++'. I...

Can the PHP value mbstring.internal_encoding be set from a htaccess file?

The following PHP command used to enable function overloading for multibyte data doesn't seem to work when set from inside a .htaccess file: php_value mbstring.func_overload 7 I read there was a bug in PHP 5.2.x versions that prevented this from working properly, however I'm using PHP 5.3.0 and it still doesn't work? But if this sett...

htaccess rewrite causes 500 error instead of 404

I've recently added this little bit of code to my .htaccess RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ $1.php [L,QSA] Ok, I understand what's happening here, I think. This little bit of code to remove php file extensions causes a loop if the document is not found. This loop causes a 500 ...

How can I stop the Apache server creating error_log files?

Is there a way to stop Apache creating error_log files using .htaccess ? ...

.htaccess rewrite rule

I am attempting to have the following url http://mysite.com/orders/10000111 rewritten to http://mysite.com/orders/details.pl/10000111 Here is what I have in my .htaccess RewriteEngine On RewriteBase / RewriteCond %{SCRIPT_FILENAME} ^orders\/([0-9]+) RewriteRule ^orders\/([0-9]+)$ orders/details.pl/$1 [NS,NC,QSA] Can someone help out...

Deny access to XML files

Is there a way to deny direct access to a XML file without affecting access to the SWF? ...

.htaccess redirect to a directory

This is a very silly question but I am pretty weak in htaccess. I want all files (php, css, javascripts and images) located at http://localhost/template/* to point to http://localhost/* along with a 404 Error Handler that is located at http://localhost/tempalte/404.php I almost got it here but when I change RewriteRule ^(.*)\.(css|php...

Why am I getting a redirect loop?

I have a website with a for example (http://example.com). I want any requests for / i.e. http://example.com to be redirected to http://example.com/stuff. I added a .htaccess file with the following line: redirect 301 / http://example.com/stuff Any suggestion? ...

Mod Rewrite path issues

I have successfully created rewrite rules to handle URLs like http://example.com/xyz http://example.com/xyz/ http://example.com/xyz/abc http://example.com/xyz/abc/ Here is the mod rewrite & regex: Options +FollowSymlinks RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d Rewrite...

how to add php tag in htaceess file

how i can write a PHP file that overwrites .htaccess with the correct information ...

ErrorDocument 404 Not Sending Referrer Information: PHP

I'm using a standard htaccess ErrorDocument 404 to redirect users to a new page. In order to customize the 404, I need to know their referrer information (from the page they Tried to visit). $_SERVER['HTTP_REFERER'] is empty I printed out all of my global variables and most contain the link to pageNotFound.php. How can I retrieve thi...

can you get me * out aaa.*.domain.com using regex ?

Hi, No matter how hard I try I can't get this.. This matches the whole domain only when it's format is aaa.bbb.ccc . ^[^.]+\.[^.]+\.[^.]+$ Our domain name is static (domain.com). So this needs to select * out aaa.*.domain.com. aaa may or may not be there. Thanks! ps: sorry for aaa part being unclear. it's another unknown. so it i...

how to check $1 and $2 subpatern exists or not in htacess

I want to implement htaccess rewriting for the following criteria Url we are having example.com/param1 Url we are having example.com/param1/param2 For url 1 I need to redirect to example.com/param1.php For url 2 I need to redirect to example.com/param1/param2.php How to write the htaccess code for this condition?? ...

Mod Rewrite ignoring -d

After a day or two, I am still fighting with Mod Rewrite. It seems that 60% of my development time is spent battling the server. My current URL structure is such that all http://example.com/xyz and http://example.com/xyz/abc should be handled by index.php. The problem is I have a http://example.com/admin/ section, which is a real direct...

htaccess file adds the virtual directory address to the url

I wrote a script to add shtml extension to all requests that don't have it. This is it: Options +FollowSymlinks <IfModule mod_rewrite.c> RewriteEngine on RewriteCond %{REQUEST_URI} htmlTemplates RewriteCond %{REQUEST_FILENAME} !\.shtml$ RewriteRule ^.*/(.*)$ $1.shtml [r,nc] </IfModule> I tried it on my local server, w...

Is there a better way to handle authentication?

Right now I have a server set up for multiple clients: clientA, clientB, clientC. Each client has their own users. The way I have it setup is clientA goes to http://www.site.com/clientA and is presented with a login screen which is triggered by an .htaccess file in a directory called /clientA. The .htaccess file has rules which direct...

.htaccess File Options -Indexes on Subdirectories

I have the following .htaccess line, simple no indexes on root. Options -Indexes What do we add so it propagates to any sub directory instead of having to create one file for each? One .htaccess on root only. ...

Site images don't refresh after setting expired headers on .htaccess

I have a site that uses a CSS sprite for all the images. I set the .htaccess file to set the expired headers to a future time as they recommend to improve site performance. However, when I updated the sprite image none of my browsers on two different computers seem to fetch the new image. I deleted the .htaccess serveral times but no l...

.htaccess ignores directories

Hi, I have a problem with my .htaccess file. It ignores real directories and redirects directory requests to news.php like this: http://localhost/dir%5Fname/?category=dir%5Fname It adds "?category=dir_name" if I request a real directory. I don't want any redirects for real files or directories. But I couldn't find the problem. Rewrit...

How to increase the idle session expiry in php through htaccess?

Anybody can help on how to increase session expiry in php through htaccess? So far I got this: php_value session.cookie_lifetime 14400 php_value session.gc_maxlifetime 14400 php_value session.gc_probability 1 php_value session.gc_divisor 1 If I'm not mistaken, the life time of the cookie will be of 4 hours. What I'm trying to do is ...