.htaccess

Adjusting dynamically generated links using .htaccess or any other method?

I have an e-commerce website (created with a ecommercetemplates shopping cart PHP template) and on the catalogue pages there are, at times, a few pages which are numbered at the bottom. The links to these pages are, for example, in the form:- /product.php?cat=27&pg=2 despite the main page having been mapped to:- /widgets using a rewrite...

.htaccess seems to be ignoring RewriteCond

Hi, This is the htaccess I have: Options +FollowSymlinks RewriteEngine on RewriteCond %{REQUEST_URI} !^/pages RewriteRule ^(.+)/$ /$1 [NC] RewriteRule ^$ /pages/index.php [NC] RewriteRule ^([a-z]+)\?([^/]+)$ /pages/$1.php?$2 [NC] RewriteRule ^([a-z]+)/([^/]+)$ /pages/$1.php?q=$2 [NC] RewriteRule ^([a-z]+)$ /pages/$1.php [NC] ErrorDocum...

auto_prepend_file works, auto_append_files does not

In my .htaccess on my 127.0.0.1 running Apache on Linux: # prepend and append files php_value auto_prepend_file /var/www/..../prepend.php php_value auto_append_file /var/www/..../append.php So the prepend file is working fine, but the append file is not. I try to do it do unlink() operations on a www-data owned file and nothing. I'd l...

conditional statement for redirecting IPs using .htaccess?

Hey guys, I am hosting my own server and have two ip addresses for it (one for people connecting from within intranet and one for people connecting from outside) and I have two dynamic dns's redirecting to these ip's. I have just installed/setup SSL on my apache2-based server, and am trying to use .htaccess to force users to use https. I...

Legacy URLs in CakePHP using routes or htaccess

I'm in the midst of moving a site from "plain old" php to the CakePHP framework and I need to be able to handle some legacy URLs, for example: foo.com/bar.php?id=21 is the pattern of the current URLs, but in the new site using cake, that URL needs to redirect to: foo.com/blah/21 So basically, I need to be able to grab that ID numbe...

Django + basic http auth

Hi, I am using Django via FastCGI. I have a non-django part of my website and I need to protect it with basic apache auth. Here is a part of my config: RewriteEngine On RewriteBase / RewriteRule ^media(.*)$ - [L] RewriteRule ^SUPERSECRET(.*)$ - [L] RewriteRule ^images(.*)$ - [L] RewriteRule ^robots.txt$ - [L] RewriteRule ^(admin_media/...

Problem with htaccess and mod_rewrite on new server

My htaccess file is a bit complex but it used to work on my old host and it works on my local machine. I transferring to ipage.com and none the rewrite rules works, For example : RewriteRule ^([\w]+)$ /index.php?module=view&id=$1 [L] used to make this url /asd display /index.php?module=view&id=asd i already spoke with a rep and all ...

.htaccess Redirection for Querystrings

Hi, I have an old website that URLs were like /page.aspx?sch=XXXX&prg=YYYY. I want to redirect those old URLs to my new website's URLs. I'm trying to use an .htaccess file to do the trick but I couldn't get it work. What I want is: /page.aspx?sch=XXXX&prg=YYYY ==> /page/sch/XXXX/prg/YYYY If someone could helped me, I'd be very please...

Re-direct problem with HTACCESS edit

Hi, RewriteEngine On RewriteCond %{HTTP_HOST} ^tsgcs\.ca$ RewriteRule (.*) http://www.tsgcs.ca/$1 [R=301,L] This is giving me errors 'Firefox has detected that the server is redirecting the request for this address in a way that will never complete.' Any ideas why? ...

Match "full stop" in mod rewrite

At the moment I am just matching numbers, letters, dashes and underscores in my .htaccess file: RewriteRule ^([A-Za-z0-9-_]+)/?$ index.php?folder=$1 I also want to match full stops in the string. I don't want to use: (.*) I have tried: ([.A-Za-z0-9-_]+) ([\.A-Za-z0-9-_]+) ([\\.A-Za-z0-9-_]+) ([A-Za-z0-9-_\.]+) None of which seem...

Codeigniter, OpenID and .htaccess problem

I'm trying to use Codeigniter OpenID library (http://codeigniter.com/wiki/OpenID/) and everythyng work fine with default configuration of ci without .htaccess. When I remove index.php by changing config.php and .htaccess I get 404 Page Not Found when I try to verify my openid (http://ci.dlsb.eu/test/) Can anybody tell me where I'm wrong...

flash and htaccess issue?

I have a flash swf application and the swf need the support of the .php files to get data. But my server folder is protected with htaccess and htpasswd. So the access from flash is not possible. How can I overcome this situtation? ...

Help with htaccess and two Wordpress instances.

I have an old legacy application, written in php. It's going to be replaced by two Wordpress instances, one being the website itself and the other being a blog (I have to use them separated as two instances). So I'm going to have a dir for this old version, a dir for the site and a dir for the blog. This is my situation now: Suppose my...

Using PHP script to assist .htaccess mod_rewrite

I'm planning to use large amounts of URL rewrites on my website, but I can't get familiar with Apache's mod_rewrite because it's difficult and poorly documented. I heard there's some option that allows invoking various scripts for the rewriting purpose. Can you help me with it? ...

Problem with mod_rewrite

Hello all, I have a problem with getting my .htaccess to work like I want and I was wondering if anyone could shed a light on this. Here is my current setup: My shared hosting site can be accessed by http://www20.a2hosting.com/~myname/ I have several sub directories inside that I wish to access. For instance http://www20.a2hosting....

.htaccess redirect only if ip address is not listed or not a specific url

I'm trying to setup a staging subdomain and only want to allow access to certain ip addresses, but allow everyone access to any url starting /api. What I have below works for the ip address, but always redirects if I try and access for example /api/projects or /api/users with an ip address not listed. Any help would be greatly apprecia...

How To Redirect site to a new domain and display moved message

Hi Im trying to move a webpage from one domain to another. Is there some way of doing the following, when a user gets into my page. Enters domainOld.com/aUniquePage.html Display domainOld.com/WeAreMoved.html Redirect 301 domainNew.com/aUniquePage.html Would that be possible with a .htacess and would google understand the 301 redirec...

How can I rewrite URL in my case

Hi guys, I have read related Q&A's for this is question, but still I am confused on this, can somebody help me on this? What I am doing: my url is : www.mysite.com/home.php I have two files: home.php and get_data.php, in home.php i am calling get_data.php with the use of jquery. the code for jquery is: $(document).ready(function(){ ...

URL-Rewriting help

Hello, I am new to URL rewriting and saw in many sites the effect of URL Rewriting. I am completely new to this area. Even, i am finding hard to learn this. The help is, I want to rewrite http://www.example.com/resources/pages/demos/any-page.html to http://www.example.com/demos/any-page.html omitting the resources/pages/ directory...

URL rewrite in smarty based website?

I wanted to achieve this example.com/search_results/?action=search&username[equal]=PorscheSA to example.com/PorscheSA I have used .htaccess for many websites to achieve this, but since this website is smarty based, it doesn't seem to work. Any help will be much appreciated. Ok, this is the .htaccess file: RewriteCond %{HTTP_HOS...