.htaccess

.htaccess subdomains and common files

Hello I have a file structure that serves mutliple domains with a top level .htaccess pushing requests down to the domain specific directories: ... ReWriteCond %{REQUEST_URI} !webroot/domains/www.sitea.com/ ReWriteRule ^(.*)$ webroot/domains/www.sitea.com/$1 [L] ReWriteCond %{REQUEST_URI} !webroot/domains/www.siteb.com/ ReWriteRule...

Magento; dispatch multi store

Hi all, I've set up the following multi site structure in Magento (1.3.2.4); Site | Store | View -------------------------- Site A | Store A | View A Site B | Store B | - So, 2 site codes and 1 view code. Is the (empty) view of Store B inherited from Store A? And what if "Store B" was left blank, would that inherit the root ca...

mod_auth User Credentials

I am trying to write a PHP script that will create a file in a dir and fopen)() and then fwrite() to it. -- No success (if curious why then read through this thread http://stackoverflow.com/questions/2230391/php-shell-exec-and-sudo-must-be-setuid-root) Approaching this from a different angle, I am considering using a .htaccess with a mo...

.htaccess 301 redirect problem

I have the following two 301 redirects in my .htaccess file. The first redirect /faq.php works fine but the second one just gets a 404 error. Can anyone suggest why this may be happening? Options +FollowSymLinks RewriteEngine on redirect 301 /faq.php http://www.mysite.com/faqs redirect 301 /reports/index.php?regionid=14 http://www.my...

Handle multiple accounts and users in one CakePHP app with URL domain.com/account/controller/action

What I need to accomplish is a single Application with a single database but multiple accounts (companies), each with multiple users. The URL convention must be as follows: domain.com/account/controller/action So ALL controllers are prefixed by the company/account name. All accounts would share the single database, but each one would ...

Problems with htaccess ReWrite rule in a top level domain

Any ideas on why this rewrite rule works in a subdomain, (dev.domain.co.uk) but not when placed in the top level domain (domain.co.uk) fails with a 500 Internal Server Error ? ReWriteEngine on ReWriteCond $1 !^(images|img|stylesheets|db|themes|index\.php) [NC] RewriteRule ^(.*)$ /index.php/$1 [L] It meant to parse all files as if the...

Conditional php_flag statements in .htaccess

Is there a way to conditionally execute php_flag statements in .htaccess? Here are two things I'm trying to do: Turn error reporting on if the client's IP address matches the IP address I use: if %{REMOTE_ADDR} == '12.34.56.78' then php_flag error_reporting 1 else php_flag error_reporting 0 Turn off register_globals if the IP a...

Links to files inside PHP/HTML code subject to .htaccess mod_rewrite too?

Just wanted to make sure: When I write: require('/path/to/file/file.php'); Is the file required with respect to Apache's mod_rewrite? (which seems unreasonable, since it should be there for user URL redirection) What I mean is, that if .htaccess sends all requests to "index.php", index.php would be required instead? And When inside...

.htaccess and mod_rewrite help

Using mod_rewrite, how could I turn URLs that follow this pattern: http://example.com/index.php?id=14 Into this pattern: http://example.com/14/ ...

Images can not be found after using mod_rewrite

Hi, In order to make nice and friendly SEO links I'm using this: Options +FollowSymLinks RewriteEngine on RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)\.html$ page.php?ida=$1&idb=$2 [QSA] So http://www.example.com/solutions/hardware.html will be: http://www.example.com/page.php?ida=solutions&idb=hardware This works. But the pro...

Trailing slash and initial www

I have this htaccess: RewriteEngine On # redirect with www RewriteCond %{HTTP_HOST} ^mydomain [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1/ [R=301,L] # add .php internally RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ $1.php [L,QSA] So my .php files can be called wit...

mod_rewrite ignored/not working

I am having some issues with mod_rewrite on a new Apache dev PC I have set up. I have enabled mod_rewrite as an apache module and editted the conf file to allow rewriting, however when I try creating rewrites nothing happens. The htaccess file is being invoked to some extent as I am able to cause a 500 error by putting invalid syntax i...

Apache rewrite URL but don't rewrite certain folder

I am using Apache to rewrite my URLs into clean URLs. RewriteRule ^(.*) index.php Currently this rewrites directories too, which is what I want, since I want everything run through my router/index.php file. What I would like to do however, is have one folder that I can access directly. This is for lib files such as .js and .css file...

appending a paremeter with .htaccess

Hi all, i'm struggling with an htaccess rewrite command what I have is RewriteCond %{HTTP_HOST} ^www.mywebsite.co.uk$ RewriteCond %{REQUEST_URI} !^/subfolder/ RewriteRule ^(.*)$ /subfolder/ I have a few URLs going to the same folder, some of them redirect to subfolders, which then run different templates. However, I also need to ap...

Redirect *.php to clean URL

My htaccess doesn't quite work: RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)\.php$ /blah/$1 [R=301,L] RewriteRule ^(.*)$ /blah/index.php/$1 [L] Basically /blah/about.php should redirect to /blah/about I'm using codeigniter so the last line is required to process URL's. Th...

Catching multiple levels of 'virtual' directories with htaccess

Currently I have the following rules... RewriteRule ^([^/]+)/([^/]*)(.htm)?$ index.php?filter=$1&page=$2 [L,QSA] RewriteRule ^([^/]+)/$ index.php?filter=$1 [L,QSA] Which basically catch anything in /dirname/page.htm Now there exists the chance that the script will have to intercept a variable level of paths, such as /dirname/twodirna...

What is apache htaccess configuration to require authentication for all except for these URLs?

Hi, What is the htaccess lines/config I would require to ensure that all parts of my site (files & URLs) are protected by authentication, EXCEPT for a given limited set of URLs. For example all except "/api/.*" if this makes sense. The actually authentication could be like the below, but it's how I wrap this in the directives... AuthN...

.htaccess or other URL Case Sensitive

My server is Case Sensitive, and id like to turn it to inSensitive. Example of what I mean is lets say I upload Fruit.php Well then going to this file wont work: www.website.com/fruit.php but this one will: www.website.com/Fruit.php Is there a way so Fruit.php and fruit.php will work? also with the directories. i.e: /Script/script.php ...

is if else conditions available on htaccess?

Hi All, I have a .htaccess file in the folder "services" in my website and have to give two urls following content of htaccess #------------------------ <IfModule mod_rewrite.c> RewriteEngine on RewriteRule ^(.*)$ index.php?n=$1 [L,QSA] </IfModule> $------------------------- 1. http://www.mysite.com/services/seo-work 2. http://w...

htaccess rewrite rule doesn't work

Hi, in my .htaccess file i do have these lines: Options +FollowSymLinks RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([a-zA-Z0-9_-]+)/([0-9])/([a-zA-Z0-9_-]+)\.(html)$ /first_gate/index.php?show=true&_=$1&__=$2 [QSA] So calling: http://www.domain.com/a-b-c-d/123/an-thing-here.html in the background it's intend...