0 Replies - 1487 Views - Last Post: 21 April 2012 - 08:22 AM

#1 4D1   User is offline

  • D.I.C Head

Reputation: 22
  • View blog
  • Posts: 225
  • Joined: 22-October 09

.htaccess rewrites

Posted 21 April 2012 - 08:22 AM

Hi Guys,

I am trying to create a .htaccess file that does several things, unfortunately all the tutorials and examples seem to dismiss any explanation and just say 'use this' and having little server configuration experience the apache docs are a bit cryptic to me.

What I am trying to do is:

1. redirect non http : //www.whatever..... to http : //www.whatever.....
2. redirect index.php/whatever to http : //www.whatever.co.uk/whatever
3. rewrite http : //www.whatever.co.uk/whatever to http : //www.whatever.co.uk/index.php?uri=whatever
4. not rewrite/redirect for .css, .js, .jpg etc

I have tried loads of combinations, but at present this is the content of my .htaccess file
<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine On
	RewriteCond %{HTTP_HOST}     . 
	RewriteCond %{HTTP_HOST}     !^www\.example\.co\.uk 
	RewriteRule (.*)             http : //www.example.co.uk/$1    [R=301, L] 
	RewriteRule ^index\.php(.*)  /$1                             [R=301, L]
	RewriteRule (.*)             index.php?uri=$1                [L]

Unfortunately I am also not great with regular expressions, this is what I interpret the above file to mean.
RewriteCond %{HTTP_HOST}     .                         
//Not sure, the examples said use it

RewriteCond %{HTTP_HOST}     !^www\.example\.co\.uk    
//If the HTTP_HOST does not start with www.example.co.uk

RewriteRule (.*)             http : //www.example.co.uk/$1    [R=301, L] 
//If the above conditions are true, redirect to 

RewriteRule ^index\.php(.*)  /$1                            [R=301, L]
//If the url begins with index.php and may or may not be followed by any characters redirect to domain name/whatever

RewriteRule (.*)             index.php?uri=$1               [L]
//whatever the url is rewrite it to index.php?uri=whatever

So I cant understand why this is not working??? Any help or suggestions would be appreciated.

******EDIT: Now Resolved******

This post has been edited by 4D1: 22 April 2012 - 05:41 AM

Is This A Good Question/Topic? 0
  • +

Page 1 of 1