.htaccess

.htaccess mod_rewrite just broke the site...

hello, in the following .htaccess file... RewriteEngine on RewriteCond %{HTTP_HOST} ^getpearson.com$ RewriteRule ^/?$ "http\:\/\/www\.getpearson\.com" [R=301,L] RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php RewriteCond %{REQUEST_FILENAME} -f RewriteRule ^ - [L] RewriteRule ^rede...

Mod_rewrite, how to stop rule applying to one query string?

Hi, I have a list of rewrite rules, but one of the rules is applying to something I need it to not apply to. Here is the rewrite rule causing the problem, RewriteRule ^([^/]*)/$ /category.php?category=$1 [L] It's meant to rewrite .com/catname/ to /category.php?category=catname which it does fine, but I need it to not apply to anythin...

Subdirectory .htaccess affecting other directories

I'm having a strange .htaccess issue. My web structure is setup like so to have two sites: www/site1/ www/site2/ inside the site1 directory, I have a .htaccess file with rewrite rules in it. Inside the site2 directory, I have a different .htaccess file with different rewrite rules. My problem is that the rules in www/site1/.htacces...

.htaccess - Rewrite a request to one directory before the request is handled by that directory?

I'm trying to exclude all BUT one directory from a rewrite rule. I want the request to be handled by the index.php file in the root directory which will then include the subdirectory's index.php file as part of a script after wrapping it with it's own code. This is a really strange problem, since I'm trying to wrap Drupal within a Word...

htaccess vs password protected directories

I have to add a password protected zone to a site I am working on (using the .htpasswd file). The thing is the whole directory structure it's being pointed at doesn't exist and is created through mod_rewrite. Will it still work, or does the directory actually have to physically exist on the server? Clarification: While I may need to p...

htaccess redirection problem alias vs. directory name

When I use this rule: RewriteRule ^Chats/([^/]+)/?$ Chats/ChatPage.php?chaturl=$1 [NC] I get $_GET["chaturl"] as ChatPage.php where I should get $1. How can I solve it? If alias and directory name are not the same, there is no problem. If I use RewriteRule ^Chat/([^/]+)/?$ Chats/ChatPage.php?chaturl=$1 [NC] (NOTICE IT'S CHAT NOW NOT CH...

Redirecting with mod_rewrite and mod_geoip only if user asks for the root of the domain and are from a particular country

Hi, I need a rule and condition to handle this scenario: User from US visits www.domain.com, domain.com, www.domain.com/ or domain.com/ this should be redirected to www.domain.com/usvisitor/ However, if a user from the US visits www.domain.com/anydirectory it will let them straight through without a redirection occurring. eg. Rewrit...

htaccess mod_rewrite check file/directory existence, else rewrite?

I have a very heavy htaccess mod_rewrite file that runs my application. As we sometimes take over legacy websites, I sometimes need to support old urls to old files, where my application processes everything post htaccess. My ultimate goal is to have a 'Demilitarized Zone' for old file structures, and use mod rewrite to check for existe...

Wordpress auto-generated "canonical" links - how to add a custom URL parameter?

Hello - Does anyone know how to modify the Wordpress canonical links to add a custom URL parameter? I have a Wordpress site with a page that queries a separate (non-Wordpress) database. I passed the URL parameter "pubID" to display individual books and it is working OK. Example: http://www.uglyducklingpresse.org/catalog/browse/item/...

Can I unprotect a single script via .htaccess using CodeIgniter?

I'm in a development environment and we're using basic .htaccess/.htpasswd authentication to keep lurkers out. But some of my AJAX calls are coming back with HTTP/401 authentication failed errors. Is it possible for me to allow access only to those specific URL's? I can't easily do it by popping a new .htaccess in a subfolder because Cod...

Redirect in combination with a rewrite condition in htaccess

Hi all! I've got a cms-driven website, with no option to change the code. What I want to accomplish is creating friendly url's, using only apaches mod-rewrite engine. The problem is I'm creating an infinite loop, because I first redirect the original url (index.php?id=21) to a friendly one (/friendly/) and then rewrite the '/friendly' ...

How can strip index.php? but allow /?ACT to function?

I'm using the following ht access file to strip index.php from my URLs # secure .htaccess file <Files .htaccess> order allow,deny deny from all </Files> ReWriteEngine on RewriteBase / ReWriteCond $1 !(img|safe-area|library-shelf|images|system|themes|index\.php) [NC] ReWriteRule ^(.*)$ /index.php?/$1 [L] This works for the server t...

Many RewriteBase in one .htaccess file?

Hello I have a domain and a wordpress-blog on same server. Now I have a problem (surprise). The wordpress is located on /httpdocs/blog/ and domain is pointing to /httpdocs/ and I'm trying to redirect it to /httpdocs/domain/. But, obvisiously, I have permalinks in Wordpress. Here's my current .htaccess: RewriteEngine On RewriteBase /b...

Htaccess Rewrite Rule

Hi, I'm getting crazy with .htaccess and rewrite rule. I'd like to understand how it works, I hate it, anyway here's my problem. (really simple for most of you) My site has one main page index.php. This is the only page, all the others are handled by this one. I did a simple RewriteRule: RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?page...

Need help with htacess - over and over

Hello! I have a few lines in my .htacess Options +FollowSymLinks RewriteEngine on RewriteCond %{HTTP_HOST} ^mydomain.org [NC] RewriteRule ^(.*)$ http://www.mydomain.org/$1 [L,R=301] # index.php to / RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /.*index\.php\ HTTP/ RewriteRule ^(.*)index\.php$ /$1 [R=301,L] # forum RewriteCond %{REQUEST_U...

How to rewrite a URL with %23 in it?

I have a (wordpress) blog where after commenting the users are redirected back to the page with an anchor to their comment. Should look like this: http://example.org/foo-bar/#comment-570630 But somehow I get a lot of 404 ins my logfiles for such URLs: http://example.org/foo-bar/%23comment-570630 Is there a way to write a .htaccess re...

Setting custom php include path in .htaccess on mac os x

in /Users/username/Sites/somesite/.htaccess I have AllowOverride All php_value include_path ".:/Users/username/Sites/somesite/inludesFolder:/usr/lib/php" I have also modified /etc/apache2/httpd.conf to AllowOverride All and restarted websharing, but it's not finding the additional include path. I'd like to avoid modifying t...

Redirect a specific IP address to a special page of my homepage with .htaccess

How can I use .htaccess to forward a visitor of a specific IP address to a webpage on my server? This example causes an infinite loop: RewriteCond %{REMOTE_ADDR} ^123\.\123\.123\.123$ RewriteRule ^(.*)$ /specialpage.php [R,L] I found this on the web but it just does not work: SetEnvIf REMOTE_ADDR 123.123.123.123 REDIR="redir" Rewri...

Is it possible to limit outside connections to a subdomain with .htaccess or similar?

I host a web application. This application serves static html pages that are refreshed at various intervals. Some as often as every 30 secs. At this time I have about 300 unique pages that are accessed via 300 unique subdomains. Some clients have at most 50 visitors to their unique page and it refreshes every 30 secs, no problem. Other c...

Sitewide 301 Redirect with a subset of different redirects

I am trying to make a sitewide 301 redirect for a site with around 400 pages but also have a subset of about 10 individual pages that don't follow the sitewide redirect and should point somewhere else. Any ideas how to format such redirect rules so the sitewide redirect doesnt conflict with the subset pages redirect? I am starting wit...