mod-rewrite

URL rewrite issues using .htaccess

I'm trying to write a URL like below, but when I try to call the seo queryparam, it always returns index.php. Any idea why it isn't returning the correct value for 'seo'? RewriteRule ^([^/]*)$ index.php?c=home&m=details&seo=$1 [L] The URL it should forward from would be something like this: http://domain.com/The-Name-of-the-Product. ...

How to hide the .html extension with Apache mod_rewrite

I have a small number of static sites where I simply want to hide the .html extension: the url /foo fetches the static file /foo.html the browser still displays the url /foo The client can then send out bookmarks in the style mydomain.com/foo rather than mydomain.com/foo.html. It sounds very simple, and I've used mod_rewrite happily...

.htaccess and page names.

I have a fairly massive web site for which I need to modify the names of the files shown in the URL. I am using Apache 2 with mod_rewrite enabled. I currently have the following configuration in my .htaccess file: RewriteEngine on RewriteBase / RewriteRule ^CakeList\.php$ TastyThingsList.php [T=application/x-httpd-php] Now, when I a...

Case Insensitive URLs with mod_rewrite

I'd like for any url that doesn't hit an existing file, to do a lookup on the other possible cases and see if those files exist, and if so, 302 to them. If that's not possible, then I'm ok with these compromises: Only check the lowercase version Only check the first path portion For example http://example.com/CoOl/PaTH/CaMELcaSE sho...

rewriting links in scraped content using mod_rewrite

Hi, I'm looking to create an iframe on my site that contains amazon.com, and I'd like to control it (see what product the user is at). I realize I can't do this because of browser security policy issues, and the only real workaround is to feed the entire page through my server. So I load the page and I change all the href values from som...

Trailing slashes problem

When I type this "http://example.com/Hello%20There/" , it displays the index page wich is : "http://example.com/Hello%20There/index.html" . Well, what I want to do is when the user types "http://example.com/Hello%20There" (so like the first one except it doesn't have a trailing slash). I tried many things and specially regular express...

Apache mod_rewrite with multiple parameters

I've been struggling to get the following rewrite working ^/agatedepot/([0-9.]+)/([0-9a-zA-Z._]+)\?doc-id=([0-9a-zA-Z._\-]+) to /agateDepot.php?date=$1&filename=$2&doc-id=$3 I know that mod_rewrite is working. I know that it is reading the .htaccess file, I'm just not seeing any redirecting happening. Here's what I have in my .ht...

.htaccess redirect all files in one folder to exact same in another folder

We simply have to move every page inside of a directory called "Music" to a directory called "Information"... That's the only change. There's lots of links to pages music and we don't want to break them all. I'm not great at rewrite conditions.... Basically, all I want to do is when a user types in music/index.php, for example, or musi...

.htaccess redirect request not index.php

I have a setup like this http://www.example.com/reroute/index.php. I would like to send all request not to index.php to index.php. So anything to /reroute/products would go to /reroute/index.php and would display http://www.example.com/reroute to the browser. It seems simple enough but every thing I have tried either tells me file doesn...

Redirecting /media/* to /project/media/* and everything else to /dispatch.php

I have the following rewrite rules: <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / # Route requests to /media/* to /projects/media/* RewriteRule ^media/.* - [NC,L] # Route all URLs to dispatch.php. RewriteRule ^(.*)$ dispatch.php [L] </IfModule> This redirects everything to dispatch.php, unless the URL is exampl...

Apache Rewrite Rule Problems

I have a list of folders in the htdocs that I want to include in my Apache configuration file, but I don't want to include every directory that's there manually, as more may be added later. I have 5 or so folders redirecting correctly, another redirect that does to the old index.htm in the htdoc's folder and another that does to the che...

Rewrite rules showing in location bar of browser.

I have the following rewrite rules: <IfModule mod_rewrite.c> RewriteEngine on RewriteBase / # Route all URLs to dispatch.php. RewriteCond %{REQUEST_URI} !media/ RewriteRule ^(.*)$ dispatch.php [L] #Route requests to /media/* to /project/media/* RewriteRule ^media/(.*)?$ project/media/$1 [L] </IfModule> Everything is r...

using header() to rewrite filename in URL for dynamic pdf

I have a php script that generates a pdf report. When we go to save the pdf document, the filename that Acrobat suggests is report_pdf, since the php script is named report_pdf.php. I would like to dynamically name the pdf file, so I don't have to type the appropriate name for the report each time that I save it. Asking on a news group...

How can I use mod_rewrite to remove everything after the ? (question mark) in a URL?

How can I use mod_rewrite to remove everything after the ? (question mark) in a URL? For instance: http:// 127.0.0.1/ALL_FILES.php?test=1 after mod_rewrite: http:// 127.0.0.1/ALL_FILES.php For php this means that the $_GET super global will always be empty for all files on the system. Thank you. ...

Strange behavior change in mod_rewrite

Hello, In a .htaccess context, I have a simple rewriting rule : RewriteEngine on RewriteRule ^dir/([^/]+)/(.*) action/do.php?a=$1&b=$2 [L,QSA] dir and action are in the same directory, which is also my DocumentRoot. When accessing http://example.org/dir/a/b the request should (and was) rewritten to http://example.org/action/do.php?a...

Apache Mod Rewrite

In my Apache configuration, I have the following statement: RewriteRule ^/classic(.*) /$1 [nc,l] This will return all statements to http://localhost/classic basic the base htdoc folder (so index.html is used) I want to be able to enter http://localhost/classic/somefolder and make it go the a specific folder in the htdocs. How would ...

php .htaccess rewrite with new cpanel account

I have the following in my .htaccess file, which I do often for cleaner URL's. There are pro's and cons to this I know and I think I've found a con. RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME}\.php -f RewriteRule ^(.*)$ $1.php Options All -Indexes I've up a new cPanel account for this websit...

How to write this rewrite rule in Apache?

If user visits /abc, and there is no file/directory named abc under /,redirect it to /test.php?from=abc, but if it exists,don't redirect. ...

Legacy links rewrite

I need to rewrite: index.php?node=[something] to /node/[something] (the "node" part will be static text and it's not important) i've tried: RewriteRule ^index\.php?node=(.*)$ /node/$1 [L,R=301] (again the rewritten "node" part will be static text and it's not important) and a lot of other variations without success... Thanks...

how to biuld a subdoamin from script

In my project i have to make a subdomain, i.e if the user name is XXX when he register, a sub domain will be created like XXX.example.com how to do it? I will use php for scripting. regards tarique ...