Quick htaccess/redirect question |
[eluser]dimensionmedia[/eluser]
Got the initial htaccess code from the wiki working great. My CI site currently resides in a subdirectory on the main site - my .htaccess file lives in that directory. so: www.mysite.com/subdirectory/index.php/home/category/clothing becomes www.mysite.com/subdirectory/home/category/clothing however, I want the above url to become this: www.mysite.com/subdirectory/clothing.php basically take the controller "home" and "category" out of the url. i also want the ability to add another uri and maintain the flow, for example: www.mysite.com/subdirectory/home/category/clothing/mens becomes www.mysite.com/subdirectory/clothing/mens.php This is my .htaccess file right now (standard from the wiki i think): <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /onlinecatalogs/ #Removes access to the system folder by users. #Additionally this will allow you to create a System.php controller, #previously this would not have been possible. #'system' can be replaced if you have renamed your system folder. RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php/$1 [L] #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn't true it sends the #request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> <IfModule !mod_rewrite.c> # If we don't have mod_rewrite installed, all 404's # can be sent to index.php, and everything works as normal. # Submitted by: ElliotHaughin ErrorDocument 404 /index.php </IfModule> Any help would be greatly appreciated! :-)
[eluser]dimensionmedia[/eluser]
Still having problems. Anyone a htaccess guru?
[eluser]SpooF[/eluser]
Code: <IfModule mod_rewrite.c> Try that.
[eluser]ontguy[/eluser]
There's an alternative to using .htaccess for this. You could add a url suffix in config.php ($config['url_suffix']) and then use routes to remove the "home" from the url.
[eluser]dimensionmedia[/eluser]
I believe it works! Thanks! Actually i'm noticing the changes between this and the oringial .htaccess file that I was trying, and the other file i was playing with earlier today. I should be able to make adjustments, learning this as I good along. So i'm walking away an educated coder on this. :-)
[eluser]Unknown[/eluser]
[quote author="SpooF" date="1218182757"] Code: <IfModule mod_rewrite.c> Try that.[/quote] Hi I try to use your configuration to create a site into my localhost with this configuration: The index.php file it's in /mysite/system/application/views/index.php why? because with this way users cannot enter to other folders the rules of the .httaccess are: Code: RewriteEngine On So, my problem is the url like http://localhost/mysite/css/common/reset.css for some reason I can't read the file reset.css Can you help me?? Thanks!!!
[eluser]Sean Gates[/eluser]
[quote author="Eaven" date="1229671793"] Hi I try to use your configuration to create a site into my localhost with this configuration: The index.php file it's in /mysite/system/application/views/index.php why? because with this way users cannot enter to other folders the rules of the .httaccess are: Code: RewriteEngine On So, my problem is the url like http://localhost/mysite/css/common/reset.css for some reason I can't read the file reset.css Can you help me?? Thanks!!![/quote] Eaven, Your problem is that Code: system/application/views/index.php Code: localhost Hope this helps. Note: I just noticed how old this post is. Ha! |
Welcome Guest, Not a member yet? Register Sign In |