static page loader with style |
[eluser]Mofceh[/eluser]
Hello, I've implemented a static page loader with style. Just a little code, that works. But only on my desktop hosting. When I uploaded everthing to a remote hosting routing does not work. First the code... in routes.php: $route['([a-zA-Z]+)\.html'] = "documents/load_static/$1"; documents.php: ... function load_static($filename) { $this->load->view("static_pages/$filename"); } If I use index.php version, it works on the remote host also. (www.example.com/index.php/static_page.html). But I want www.example.com/static_page.html to work. What can be the problem at hosting site?
[eluser]Hyra[/eluser]
Did you also upload your .htaccess? If so, make sure your webhost allows the use of that file. This is done by allowing overrides in the directive Code: <Directory "/long/path/to/your/site">
[eluser]Mofceh[/eluser]
Sorry.. "Now working." should read as "Not working." ) But now I found my problem. Anyhow, I don't know why, my "static_page.html" becomes "static_page_html". Do you know the reason behind this? Is it an apache issue or CI has anything with this?
[eluser]Mofceh[/eluser]
Solved! My hosting has some security measures I guess. _GET[] variables are converted too. So I changed my regular expression in routes.php to $route[’([a-zA-Z]+)(\.|_)html’] = “documents/load_static/$1”; Now It's working fine.
[eluser]oliviermarian[/eluser]
Hello, can you explain me what htaccess information I should put to implement this ? say my static files are in www/system/views/static . currently to manage to avoid the index.php i have this htaccess file RewriteEngine on RewriteCond $1 !^(index\.php|medias|phpmyadmin|css|js|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L] thanks for your help. Olivier. |
Welcome Guest, Not a member yet? Register Sign In |