i have been pulling my hair out for 3 days. i ve checked forums and tutorials but i just dont get it. i have a url of
http://localhost/gallery/2012/2
but i also need to get
http://localhost/gallery/2
this is my htaccess file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-zA-Z0-9_-]+)/([0-9-]+)/([0-9-]+)/?$ index.php?page=$1&date=$2&pagenum=$3 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/([0-9-]+)/?$ index.php?page=$1&date=$2 [L]
RewriteRule ^([a-zA-Z0-9_-]+)/?$ index.php?page=$1 [L]
</IfModule>
how would i go about adding another rule
RewriteRule ^([a-zA-Z0-9_-]+)/([0-9-]+)/?$ index.php?page=$1&pagenum=$2 [L]
Related
When i use
index.php/User/login its working, But when i use User/login its not working even after removing of index.php in codeigniter, can anyone say what is wrong with my code? its on live server of root directory
my htaccess file is
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
# Hide the application and system directories by redirecting the request to index.php
RewriteRule ^(application|system|\.svn) index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]
</IfModule>
Please try below code
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
I've been using this code for many years. I think it could work for you.
I am trying to use RewriteTule this simple way
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1
but I am having a trouble with this:
When I go to a url like: "empresa/premios" the images, css and other files are searched inside a folder called "empresa". Whaterver URL I try to use the images and other files are always looked up inside a folder with the name on the first parte of the url. In this case, "empresa".
Try with
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^images/(.*)$ ./public/images/$1
RewriteRule ^css/(.*)$ ./public/css/$1
RewriteRule ^js/(.*)$ ./public/js/$1
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
I know that this question has been asked maybe thousands of time before, I looked at most of them and could not fix for my case :s
I have a codeigniter framework installed on godaddy hosting company and i read that i have to create a .htacces file and put this code into:
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
But this does not fix for my case, is it that I have this site hosted under another domain?
for ex the structure of my ftp looks like below:
/
facelajm
studenti
fxclod
and I am trying to get the site following url www.facelajm.com/studenti which opens the main page fine, but when i try to login or reg it just returns me No input file specified.
Anyone could help me?
Seems that in certain configurations the CI core misses the rules, the .htaccess I'm using now:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]
ErrorDocument 404 index.php
In my case (dev: a subfolder, prod: an "addon domain") the magic was provided by those two extra lines:
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
Source:
http://www.diegodicamillo.com.ar/blog/2012/09/19/no-input-file-specified-codeigniter-error-problema-resuelto/
From your question what i understand is you are running the codeignitor in a subfolder("studenti") of the domain("www.facelajm.com"). So the below .htaccess code will work.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
And also don't forgot to change the baseurl in configuration file(application/config/config.php) like below.
$config['base_url'] = "http://www.facelajm.com/studenti"
The above .htaccess which you used in your question will work for a sub domain.
So you can also create a sub domain and map the folder to the sub domain and use the code which you used in your question(For Reference i added below).
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
And also don't forgot to change the baseurl in configuration file(application/config/config.php) to the new subdomain(assuming new sub domain as http://codeignitor.facelajm.com/) like below.
$config['base_url'] = "http://codeignitor.facelajm.com/"
Here is the .htaccess file i have on a godaddy and it works fine:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
Your problem might be the RewriteBase line if codeigniter is not in the root.
Please try this code:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.)$ /index.php [L] or RewriteRule ^(.)$ index.php?/$1 [QSA,L]
I have the following url. I want to rewrite the following url to omit the "view" from the url.
Here is currently my existing mod rewrite
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
</IfModule>
http://example.com/page/view/helloworld
How do i rewrite the url to make it
http://example.com/page/helloworld
the keyword helloworld is dynamic.
Expert advice appreciated.
You might want to add the R=301 into the flags if you are worried about transfering SEO.
RewriteEngine On
RewriteRule ^(.+)/view/(.+)$ /$1/$2 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
I am trying to configure a .htaccess file to my webpage to make it work as i want, but after a lot of searching and trying to understand the documentation, my head is just confused about these mod_rewrite.
It looks like this:
root/index.php
root/application/-subfolders-
root/config/-files-
root/library/-files-
what i want is everything sent to the index.php file as a parameter like index.php?page=$i, so i can have links like www.mypage.com/foo/bar and my index.php handles it.
ALSO i want to have the www.mypage.com/js/filename be sent to a subfolder in application,
like root/application/javascripts/filename.
I just cant get this to work, tried different answer i found both here and other places.
.htaccess at is now:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^/js/ application/javascripts/ [L]
RewriteRule ^/js/(.*)$ application/javascripts/$1 [L]
RewriteRule ^css/ application/css/ [L]
RewriteRule ^css/(.*)$ application/css/$1 [L]
RewriteRule ^images/ application/images/ [L]
RewriteRule ^images/(.*)$ application/images/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^.*$ index.php?page=$1 [NC]
</IfModule>
This should do it:
RewriteEngine on
RewriteRule ^js/(.*)$ application/javascripts/$1 [L]
RewriteRule ^css/(.*)$ application/css/$1 [L]
RewriteRule ^images/(.*)$ application/images/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?page=$1 [NC]