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
...
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...
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....
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¶m=value? Ideally, I'd like this to work for any name/value qu...
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...
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?
...
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...
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?
...
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">Link</a>
<a>:
<a href="controller/method">Link</a>
How do I achieve this same effect (anchor) in ...
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&id=0221889
http://website.com/index.php?ctrl=pelicula&id=0160399&tab=posters
Into this:
http://website.com/pelicula/0221889/
http://website.com...
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 ...
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...
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...
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 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...
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...
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...
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...
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 ...
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...