Welcome Guest, Not a member yet? Register   Sign In
URL Rewrite Rules for IIRF
#1

[eluser]koryrok[/eluser]
Hi All,

Im using CI on Windows. Can someone please tell me what the IIRF re-write rules are for removing index.php from the URL?

Thanks,
Kory
#2

[eluser]Clooner[/eluser]
Code:
#Don't rewrite when it has one of these extensions
RewriteRule (.+\.)(php|jpg|png|jpeg|gif|ttf|sql|txt|htm|zip|css)$   -   [L]
#Rewrite this
RewriteRule ^(.*)$ index.php/$1 [L]
Also lots of good working examples here:
http://iirf.codeplex.com/Wiki/View.aspx?...Title=Home
#3

[eluser]koryrok[/eluser]
[quote author="clooner" date="1239267534"]
Code:
#Don't rewrite when it has one of these extensions
RewriteRule (.+\.)(php|jpg|png|jpeg|gif|ttf|sql|txt|htm|zip|css)$   -   [L]
#Rewrite this
RewriteRule ^(.*)$ index.php/$1 [L]
Also lots of good working examples here:
http://iirf.codeplex.com/Wiki/View.aspx?...Title=Home[/quote]

Are you sure there is a dash near the end of the first rule? I tried it with and without the dash and all I get is a 404
#4

[eluser]Clooner[/eluser]
[quote author="koryrok" date="1239269653"]Are you sure there is a dash near the end of the first rule? I tried it with and without the dash and all I get is a 404[/quote]

Try this:
Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]

In case still having problems post your ini file and how and what you exactly try to rewrite...
#5

[eluser]koryrok[/eluser]
The above rules don't work either. The only rule so far that sort-of works is:

Code:
RewriteRule ^/([^/]+)$  /index.php?/$1 [I]

which works for urls like:

http://www.mysite.com/page

but fails for

http://www.mysite.com/page/var1 or http://www.mysite.com/page/var1/var2
#6

[eluser]Clooner[/eluser]
[quote author="koryrok" date="1239278090"]The above rules don't work either. The only rule so far that sort-of works is:

Code:
RewriteRule ^/([^/]+)$  /index.php?/$1 [I]

which works for urls like:

http://www.mysite.com/page

but fails for

http://www.mysite.com/page/var1 or http://www.mysite.com/page/var1/var2[/quote]

Because your regex only matches when there is only one "/"
change it to ^(.*)$

.matches any character
* means 0 or more
^=start of string
$end of string
Basically saying any string

your regex only matches when there are not more then one forward slashes

Code:
RewriteRule ^(.*)$  /index.php?/$1 [I]

should work... Be sure to correctly set the location of the index.php file! (see the forward slash before your index.php)

This should also work

Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
Again set the location of the index.php file.
#7

[eluser]koryrok[/eluser]
[quote author="clooner" date="1239279149"]

This should also work

Code:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
Again set the location of the index.php file.[/quote]

That did it. Everything seems to be working perfectly. Thank you so much!! :-)
#8

[eluser]gatewaylabs[/eluser]
Hi,


mod_rewrite is used for rewriting a URL at the server level in Apache Web Server, giving the output for that final page for search engine & visitors.

If you have Apache server than you can use .htaccess file to rewrite the URl
#9

[eluser]Clooner[/eluser]
[quote author="gatewaylabs" date="1239297780"]Hi,
mod_rewrite is used for rewriting a URL at the server level in Apache Web Server, giving the output for that final page for search engine & visitors. If you have Apache server than you can use .htaccess file to rewrite the URl[/quote]

Mod_rewrite is the Apache Module to do the url rewriting or redirecting. You can configure this in the .htaccess file.
Ionics Isapi Rewrite Filter is the IIS ISAPI filter dll which handles the rewrites or redirects. You can configure this using ini files.

The nice thing is that the syntax is for the most part the same.
#10

[eluser]gatewaylabs[/eluser]
Hi clooner,

Thanks for your reply but if i rewrite url than how search engine will reach to my new url because they have older version of the Url in their index ..if you have any idea than please share with me.


Regards,
Chirag




Theme © iAndrew 2016 - Forum software by © MyBB