I need to preserve the case of the URLS for certain controllers but codeigniter rewrites them to lowercase (due to htaccess I think).
Is there a way to bypass this?
Related
We added store codes to our urls (Add Store Code to Urls in admin) and now all our old urls are broken.
How do we rewrite all old urls to the new ones with the store codes?
Example: category/test/ (old url, broken) to en/category/test (new url with store code, working).
There is no way out of the box.
And you have the problem, that the old url is ambiguous over the store views.
I would try to add a line to the .htaccess like:
RewriteRule !^en/ en%{REQUEST_URI} [R]
I'm not well in mod_rewrite, but I hope you get the idea.
I could not find the .htaccess file in CodeIgniter framework and i'm wondering how do they do route without it? Or it is somewhere hidden?
There is no .htaccess by default provided with codeigniter. They serve it through the index.php. .htaccess is only used to direct the urls to the index.php. This way codeigniter is working in environments where rewriting isn't allowed. Another way of getting controller and function is by query strings.
Anyway the actual routing is done in system/core/Router.php so you can read the code. Since Codeigniter is open source application that can't be hidden.
Our magento site uses one domain per storefront.
I want to prevent users from switching to another storefront using the query parameter __store.
I'm setting the storecode manually in the index.php at Mage::run depending on the HTTP_HOST which works fine.
Is there a way to prevent the __store parameter from working?
My only idea so far is to filter the parameters within apache and rewrite the request... but i would prefer to use a clean way within magento.
Seeing as this param is parsed in Mage_Core_Model_App [link], it would be less messy to manipulate the request in your web server software.
Additionally, in Apache you should be able to use RewriteCond to set the MAGE_RUN_CODE environment variable, which would mean that you can revert your index.php file.
What's the goal with this restriction?
I have this site
http://cjbuilders.info/welcome/home
and all the links start with
http://cjbuilders.info/welcome
How can I use mod_rewrite to just remove
/welcome/
from the url? This should be an easy one, but i struggle with mod_rewrite.
Do you know about CodeIgniter's URI Routing? Add this into your routes.php config file and it should work just fine:
$route['home'] = 'welcome/home';
This should work, IIRC:
RewriteRule ^/welcome/(.*)$ /$1 [R]
However, guessing a bit about what's going on here, if the reason for this prefix is something like a Java app server deploying an app at a context called "welcome", then the better solution is not to rewrite the URLs but to fix the backend app server to have a null context, i.e. serve at / rather than at /welcome/.
This is because the app server will probably want to generate links to other views of its app, and will reinsert the "welcome": this becomes a pain, and means that all links on your pages will get HTTP redirects when visited (e.g. by search engines). There is no way that the proxying apache server can parse the HTML and tell when that "welcome" should be removed, so best to fix the server that's writing the links in the first place.
I have joomla site which is located in mydomain.com/somefolder/otherfolder/TheSite. I have created a rewrite rule to invisibly redirect all requests beginning with mydomain.com/TheSite to this url. It works fine.
My problem is that the urls that my menuitems point to are the old mydomain/somefolder/otherfolder/TheSite/stuff. If they were relative urls, it would work.
My question: How can I force joomla to use relative urls for the menuitems, or use the urls I explicitly specify?
Thanks in advance
Probably the easiest way to make Joomla produce only relative URLs is to edit the core method "_" of the JRoute class:
JRoute::_()
This is called by Joomla application and extensions to generate consistent URLs.
It is found in:
libraries/joomla/methods.php
Making Joomla spit out relative URLs probably isn't the best way to do it. Making the absolute URLs point correctly would.