mod-rewrite

snow leopard, mod_rewrite, codeigniter

hay guys, i'm having all sorts of mod_rewirte trouble in snow leopard. Anyone know any decent articles focused on snow leopard and mod_rewrite? Or perhaps a simple step by step guide. What i want to do is setup codeigniter so the urls looks 'pretty'. so localhost/~myusername/ci_app/index.php/mycontroller/myaction would become local...

Directing non extension files to .php

I have a file with .php extention www.example.com/thefile.php?name=123 that I want to direct the user to if the user visits any of the following aliases: www.example.com/alias?name=123 www.example.com/unreal?name=123 www.example.com/fake?name=123 Is there a way I can get this done without using a framework that already uses this stru...

Mod_rewrite-multiple pages

Hi guys I have two URLs that I would like to rewrite: /artist.php?name=x => /x /albums.php?title=y => /y This is what I put in the .htaccess file: RewriteEngine On RewriteRule ^([a-zA-Z0-9_-]+)$ artist.php?name=$1 RewriteRule ^([a-zA-Z0-9_-]+)/$ artist.php?name=$1 RewriteRule ^([a-zA-Z0-9_-]+)$ albums.php?name=$1 RewriteRule ^([a-...

Cascading resource selection using mod_rewrite

I'm looking into setting up an application where there is a core and a project namespace, where core is the default fallback to the project customisation. to this end id like to be able to cascade various resources like css, javascript etc. for the purposes of the excersize, ive simplified this as ./.htaccess ./first/firstonly.txt ./fir...

URL Rewriting Help

I'm trying to learn Regex & URL Rewriting in PHP. How can I create an .htaccess file which will rewrite (not redirect) any url to index.php?q={url}? For example: http://www.example.com/baloon to http://www.example.com/index.php?q=baloon I tried: RewriteEngine On RewriteRule ^$ index.php?q=$1 [R] ...but it is not working...

htaccess redirecting issue

My current .htaccess: <IfModule mod_rewrite.c> # Turn on URL rewriting RewriteEngine On # Put your installation directory here: # If your URL is www.example.com/, use / # If your URL is www.example.com/kohana/, use /kohana/ RewriteBase / # Do not enable rewriting for files or directories that exist RewriteCond %{REQUEST_FILENAME} !-f ...

Rewriting example.com/folder/path to example2.example.com/path

Actually the thing is that i'm having a sub domain (example.domain.com) which is redirected from other domain of a folder (www.domain/folder) . but need the rewrite rule for my sub domain which shows the url links for the main domain ie., www.domain/folder/path i need to get as example.domain.com/path. Instead of getting the main domain...

How to redirect based on Accept-Language with Apache / mod_rewrite

For language redirects we currently create folders in the web root containing an index.php file which checks the HTTP_ACCEPT_LANG server variable. e.g. for the url www.example.com/press/ in /var/www/site/press/index.php: <?php if ($_SERVER["HTTP_ACCEPT_LANGUAGE"] == "en") header("location: ../press_en.php"); else header("l...

How to redirect requests to example.com to www.example.com with mod_rewrite?

This is my .htaccess generated by wordpress that sits in my root directory. I need to modify/add to it, to direct all incoming traffic to www.example.com, instead of example.com. # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ...

Apache mod_rewrite and PHP GET Arrays

I want to have a url like http://localhost/folder1/folder2/folder3/file Then i want mod_rewrite to convert it to $_GET['d'] in the url it would look like d[]=folder1&d[]=folder2&d[]=folder3 Is this possible? Thank You. ...

How to deal with "#" in a query string in mod_rewrite?

I asked this question about rewriting old "ugly" links into seo friendly ones. I need to "extract" some information after the "sharp" symbol in some urls. I've created a regular expression to it but it can't seen to work. After my question, I created this logic for this url for example, script.php?mode=full&id=23: RewriteCond %{THE_RE...

mod rewrite howto

I use the below mod rewrite code for urls like: www.site.com/play/543 RewriteEngine On RewriteRule ^play/([^/]*)$ /index.php?play=$1 [L] How can I expand on this so I can have a couple urls like www.site.com/contact and www.site.com/about ...

Add Trailing Slash to URLs

There are quite a few results for add trailing slash .htaccess on Google, but all examples I found require the use of your domain name, as in this example: RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_URI} !example.php RewriteCond %{REQUEST_URI} !(.*)/$ RewriteRule ^(.*)$ http://domain.com/$1/...

How to use rewriterule to redirect to a php file in the same folder?

I would like to take requests for /somefolder/style.css and handle them with /somefolder/program.php So, I put the following in my .htaccess file: rewriteengine on rewriterule ^style.css$ program.php?css=1 [R=302,L] The result is that instead of redirecting to /somefolder/program.php, the server tries to redirect to: /var/www/html...

Accessing URLS by www.example.com/page instead of www.example.com/page.php

What handles the disabling of the extension? Is it APACHE or the PHP install? How would one go about configuring the web server where the .php extension is not required? Is there an option that would make both www.example.com/page.php and www.example.com/page work as the URL? ...

Removing .php with mod_rewrite

I want to rewrite all my URLs to hide the .php extension. A general rule that adds .php to all URLs obviously won't do, so I want this rule to be conditional on the fact that There is no file nor directory that matches the URL After adding the .php, there is a match I've arrived at these rewriting rules: RewriteCond %{REQUEST_FILENA...

htaccess redirect incoming url to internal page and pass GET variables

I am trying to pass URLs to my site that contain numbers like this: www.example.com/234 I want them to be rewritten like this: www.example.com/view.php?id=234 My rewrite rules that are not working: RewriteEngine on rewritecond %{http_host} ^example.com [nc] rewriterule ^(.*)$ http://www.example.com/$1 [r=301,nc] RewriteRule ...

Mod rewrite question (really a regex problem)

Ive started out with the most basic rewrite there is, take any request and give it to my index page: RewriteEngine On RewriteRule ^.*$ index.php [L,QSA] Im trying to change it now so lets say i have a directory called special, I actually want to be able to go to http://example.com/special and access whatever files are in there. I tri...

Zend Sessions: Dealing with http://www.domain.com vs. http://domain.com

What's the best way to handle this? When a user logs in a domain.com, they are logged out on www.domain.com and vice-versa. Should one always be rewritten to the other with mod_rewrite? What is the best practice here? ...

what does this rewrite actually do ?

RewriteCond %{REQUEST_URI} ^/new/ RewriteRule ^(.*)$ new.php?title=$1 [L,QSA] im confused as to what this does.... what does the REQEUST_URI do ? ...