.htaccess

read cookie with htaccess and add cookie value to URI

In htaccess with mod_rewrite, how can I read the value of a cookie and then add that value to the URI? For example, if a cookie named "foo" is set with a value of "bar", I need htaccess to redirect to: example.com/?foo=bar or any variation of that URL: example.com/folder/stuff/things/?foo=bar ...

What's wrong with this .htaccess rewrite

Hi guys, I spend a lot of time trying to figure out what's wrong with this .htaccess rewrite with no success. It produces a "500 Internal Server Error" :( RewriteEngine On RewriteCond %{REQUEST_URI} ^/(([^/]+/)*)gallery/ RewriteCond %{DOCUMENT_ROOT}%1gallery/cache/$0 -f RewriteRule ^.+ cache/$0 [L] RewriteCond %{REQUEST_FILENAME} !-f...

Apache: force ssl redirect works for all cases but one??

we are registered under verisign for mydomain.com, but not www.mydomain.com, so all of my ssl redirects must also remove the www. (if any). so the redirect must go to https://mydomain.com it currently redirects to that with: mydomain.com www.mydomain.com http://mydomain.com http://www.mydomain.com but does not work for: https://www....

How can I forward a query string using htaccess?

I am using this, at present, to rewrite URLS: RewriteEngine on RewriteRule ^([^/?\.]+)$ /page.php?name=$1 [NC] So mysite.com/home gets rewritten to mysite.com/page.php?name=home How can I make it also rewrite mysite.com/home?param=value to mysite.com/page.php?name=home&param=value? Ideally, I'd like this to work for any name/value qu...

htaccess remove .php extension, index.php AND add trailing slash

This is for basic HTML/PHP pages, no query strings, etc.. I have searched high and low and find resources for removing the 'index.php' from the URI, or removing '.php' and other file extensions.. and even adding a trailing slash. But, everytime I try to use them all, or use examples that I have found, I get a 500 server error. I may pas...

.htpasswd Problems

I have setup an .htaccess and .htpasswd file correctly and my password gets accepted, but only on the second attempt. I have read somewhere what to do about this, but I lost the page. Any suggestions? ...

ReWriteRule is redirecting rather rewriting

At the moment I have two machines that I do web development on; an iMac for work at the office and a MacBook for when I have to work on the move. They both running OS X 10.6 have the same version of PHP, Apache, etc running on them. Both computers have the same files of the website, including the .htaccess file (see below). On the Mac...

Am I missing a flag or something? RewriteRule tip needed

RewriteEngine On RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)$ index.php?p=$1&l=$2 RewriteRule ^([a-zA-Z0-9_]+)/([a-zA-Z0-9_]+)/$ index.php?p=$1&l=$2 this works fine if I do site.com/param_one/param_two/, but returns a 404 when I omit param_two. I'm a newbie to routing requests with htaccess, is there a simple quick fix? ...

Codeigniter redirect with base_url

I noticed that anchor('controller/method') produces a different result than a mere <a href="controller/method"> in that anchor() adds the base_url: anchor('controller/method'): <a href="http://localhost/dts/controller/method"&gt;Link&lt;/a&gt; <a>: <a href="controller/method">Link</a> How do I achieve this same effect (anchor) in ...

.htacces to create friendly URLs. Help needed....

Hi, I'm having a hard time with .htacces. I want to create friendly URLs for a site I'm working on... Basically I want to convert this: http://website.com/index.php?ctrl=pelicula&amp;id=0221889 http://website.com/index.php?ctrl=pelicula&amp;id=0160399&amp;tab=posters Into this: http://website.com/pelicula/0221889/ http://website.com...

Storing script files outside web root

I've seen recommendations to store some or all php include files some place other than in the web document root directory (username/public_html in my case) for the specific reason of protecting php files with sensitive information (like database connection and login info) in the event that the web server hiccups and stops protecting php ...

x.domain1.org to x.domain2.com all subdomain redirect using htaccess

Hello, I own 2 domains sio-india.org and sio-india.com What i want to do is redirect all the subdomains from 1st domain to 2nd domain. eg. home.sio-india.org to home.sio-india.com I am using this code in htaccess but it is not working. RewriteCond %{HTTP_HOST} ^(.*)sio-india\.org$ [NC] RewriteRule ^(.*)$ http://%1sio-india.com/$1...

301 Redirects, and the correct regex to go with it

Hi Guys, I have several URLs that I want to redirect to the same place, however these are dynamic URLs. The structure is something like this: http://www.mysite.com/declaration/list?[query_string] What I think would be ideal for this situation is to use some regex in my .htaccess file to redirect all these links to the sites home p...

Redirect for .htaccess Wildcard Subdomains

Hello, I've been trying to figure out a way to redirect requests for wildcard subdomains to a specific folder ( called 'core' ) and calling the requested page/file from that specific folder. For example, making all calls to -http://johnny5.mysite.net redirect to -http://mysite.net/core/, or -http://docholliday.mysite.net/login.php redir...

How do I interpolate values in the TestString portion of an .htaccess RewriteCond?

How do I interpolate values like %{REQUEST_FILENAME} in the TestString part of a RewriteCond directive? Here's what I'm trying to do: # non-existent requests to /webroot files get 404'd RewriteCond site/%{REQUEST_FILENAME} !-f RewriteRule ^/?webroot site/webroot/404 [L] # otherwise, let them in! RewriteRule ^/?webroot/(.*)$ site/webroot...

one page has more than one url. search engines give penalty please help me out.

Hi I am using prestashop as the cart for my website. I have a problem; the website used to be in dynamic urls. I enabled friendly url writing. The problem is that one page has more than one url. You can access a same page from the dynamic url and static url. In fact a single page has 9 different urls. This obviously creates problems for...

How do I redirect a not found FLV file to a 404 FLV file, using .htaccess?

Using .htaccess, how do I permanently redirect all not found *.flv files in one directory to a 404.flv file in the same directory. For example: If this file is not found: example.com/flv/*.flv Use this file: example.com/flv/404.flv Here's what I have so far (I'm very bad): RewriteCond /flv/(.*).flv !-f RewriteRule ^ /flv/404.flv [L,R...

one page over 9 different urls

Hi I am using prestashop as the cart for my website. I have a problem; the website used to be in dynamic urls. I enabled friendly url writing. The problem is that one page has more than one url. You can access a same page from the dynamic url and static url. In fact a single page has 9 different urls. This obviously creates problems for...

one page has 9 urls. I am looking for 301 auto redirect syntax for multiple urls.

Possible Duplicate: one page over 9 different urls Hi This is the third time I am asking this question. I am only looking for the syntax of how to solve this problem. I am using prestashop as the cart for my website. I have a problem; the website used to be in dynamic urls. I enabled friendly url writing. The problem is that ...

.htaccess cross browser

Hi, Im trying to load a custom error document for a 404 error using a .htaccess file on a linux server, the page gets the current page URL then redirects to another site (which is retrieved from a db) based on an id it retrieved from the URL. The current error documents are stored here: /error_docs/ - i dont have permission to upload...