.htaccess rule for codeIgniter - .htaccess

I need an .htaccess rule for the following criteria. I am working in codeIgniter
I need to change:
http://project.com/projectname/controller_folder/sub_folder_in_controller
to:
http://project.com/projectname/sub_folder_in_controller
So if any thing starts with /controller_folder/sub_folder_in_controller, I need it to be converted to /sub_folder_in_controller.
Please help, thanks in advance
-Vamsi

By default, codeigniter allows you to organize your controllers in one-level subfolders.
Take a look in the controller user guide.

Related

htaccess mod_rewrite for Opencart search page URLs

I'm having some difficulty creating an htaccess mod_rewrite rule which would take the following URL:
http://www.mydomain.com/index.php?route=product/search&filter_name=SEARCH%20CRITERIA
and make it something more along the lines of:
http://www.mydomain.com/search/SEARCH-CRITERIA
or even
http://www.mydomain.com/search?filter_name=SEARCH%20CRITERIA
Everything I've tried seems to break the SEO-friendly URLs that are auto-generated by the Opencart framework. How can this be done?
In Your .htaccess file place the rules directly behind the lines used to rewrite sitemap.xml and googlebase.xml and before the last general rule.
The rule could look like:
RewriteRule ^search\/(.*)$ index.php?route=product/search&filter_name=$1
- did not test it, it is just a guess.
Also showing us what have You tried would be highly appreciated.

htaccess rewrite remove filename

How can I change url in this way using htaccess?
http://www.domain.com/index.html?page=home
http://www.domain.com/indexf6f2.html?page=blog
To
http://www.domain.com/?page=home
http://www.domain.com/?page=blog
You could try to generate your own .htaccess file based on your rules using this site http://cooletips.de/htaccess/ .
Regards, Hiawatha
I am not giving exact solution. Just utilize the followings, then you will be able to solve other URL rewriting using .htaccess
Take help from the following URL
http://roshanbh.com.np/2008/03/url-rewriting-examples-htaccess.html
Other important regarding rewriting through .htaccess
http://corz.org/serv/tricks/htaccess2.php
RewriteRule to rename URL?
For a nice basic
http://www.yourhtmlsource.com/sitemanagement/urlrewriting.html

How to erase part of the link using .htaccess

i change the permalink of wordpress with the rule "/%postname%/" and it's working perfectly.
The only problem i use wp-commerce and for some reason generate the permalink to the product with this in the end "&negozio=NEGOZIO" and so give for every product i want to see a 404 page.
I know with .htaccess you can rewrite urls so i'm asking what's the correct rule for make a link like this :
http://www.ctssolutions.it/products-page/gestione-banconote/bj-140/&negozio=NEGOZIO
became something like this :
http://www.ctssolutions.it/products-page/gestione-banconote/bj-140/
Thank in advance

Simple URL rewrite, not redirect, with .htaccess

I'm pretty inexperienced with .htaccess so please bear with me.
I have a domain - "http://www.exampletest.com"
which redirects to a folder at a different domain where I have hosting i.e:
"http://www.differenturl.com/exampletest"
Is there an easy mod_rewrite rule where I could have anything at "http://www.differenturl.com/exampletest" show up as "http://www.exampletest.com?" An example would be:
"http://www.differenturl.com/exampletest/user.php" -> "http://www.exampletest.com/user.php"
Any assistance is greatly appreciated. I assume this easy so sorry to ask such a basic question.
Thanks
You say "rewrite, not redirect", so no, there isn't a simple way to do this. The only way to do what you ask would be to have a "reverse proxy" running on www.exampletest.com that fetches content from "www.differenturl.com/exampletest/". That isn't something you can do with mod_rewrite.
If I have understood correctly, following code might do:
RewriteRule exampletest/(.*)$ http://www.exampletest.com/$1 [R=301,L]
Please note that you add this line in the .htaccess file placed on differenturl.com server.
Hope that helps.
Cheers

htaccess rewrite rule redirect

I have some old urls
http://www.website.com/result/?q=&result=1
http://www.website.com/result/?q=&result=2
http://www.website.com/result/?q=&result=3
http://www.website.com/result/?q=&result=4
etc.. probably going up to about 60
Is there anyway I can create one rule that redirects any query that looks like this to the home page /home/ instead of my trying to redirect all of them individualy?
Thanks in advance
yes, i suppose you are using apache HTTPD. In your server configuration you can define an regular expression which filter the pattern you want. For example:
<FilesMatch "/site/*">
...
</FilesMatch>
Define a RegExp and tell where to redirect or what to do.
Hope this helps, Cheers

Resources