SEO friendly URL of opencart not working inside Codeigniter - codeigniter

I have a site which is mainly based on Code igniter.Inside that I have a store setup using opencart.Everything working fine until I try to user opencart seo friendly urls.
Once done that,it shows codeigniter 404 view.
How can I bypass CI routes when url is xyz.com/store
My Htaccess file is here :
# Customized error messages.
ErrorDocument 404 index.php
# Set the default handler.
DirectoryIndex index.php
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
#RewriteCond %{HTTPS} off
#RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.(.*)
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

The problem is likely caused in your .htaccess file. The default Codeigniter .htaccess file is set up to route all traffic to your public directories index.php. To prevent this you will need to set up a RewriteCond to exclude any directories you want to keep outside of codeigniter.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(store[^/]*)$
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]
RewriteCond %{HTTP_HOST} !^www\.(.*)
RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

Related

laravel is getting a folder as url .. https://domain-name/uploads/ckeditor

I am facing an issue that Laravel is getting my folder as a URL while in crawling. I have using redirection but still the error is present.
<IfModule mod_rewrite.c>
RewriteEngine On
# Removes index.php from ExpressionEngine URLs
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?url=$1 [PT,L]
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
</IfModule>
I have tried this i htaccess

Peroblem with laarvel project deployment to cpanel

Hope you guys are well, I have faced a problem deploying my laravel project on Cpanel. When I am hit my route URL or a root URL then it show me "404 not found"
This is the root url : https://laravel.tamimikbal.com/project1/
I have written this code on my root .htaccess file
RewriteEngine on
RewriteCond %{REQUEST_URI} !^public
RewriteRule ^(.*)$ public/$1 [L]
And this the public/.htaccess file
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
The .htaccess is not redirecting properly to the public directory. I can access and navigate on your site using "https://laravel.tamimikbal.com/project1/public/".
Try this as the contents of the .htaccess file in your root:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
I can better understand if you put how is the routing url should be looks like
anyway you can try this code:
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
RewriteBase /
while you don't have www. and https is activated on your domain you can use this code to make redirect from www. to none www and from http to https
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
the rout request and file directory you can use this code
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css|webp|JP2)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
if you want to redirect you system files to 404 page edit this code and replace your system folder and your 404 routing page
RewriteRule ^system/(.*) index.php?route=your 404 page [L]

Laravel redirect to HTTPS with .htaccess

I'm using Laravel 5.5.
Laravel has couple of .htaccess and in my case I'm working with .htaccess on root and inside the public folder.
All this time I was using this code in root .htaccess to setup the public folder:
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
and my website is loading when I enter the homepage.
After that, I wanted to force redirect all the pages using https. So, first when I try to put this code inside the root .htaccess it doesn't do anything. It keeps loading with http.
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Well, it makes sense, because when I setup the public folder, I have to put the redirect inside the .htaccess that is located inside the public folder.
OK, so I've tried like this now:
The root .htaccess:
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
The public .htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
This combination works. It does redirects to https.
But, there's one issue now. When I enter the homepage or if I open the website from the search results, the URL looks like this:
https://mywebsite.com/public/en
When I enter the other pages, I don't have issue related with the "public" path in the URL. So, let's say I want to open the contact page, the URL is https://mywebsite.com/en/contact. That's fine.
How can I avoid that "public" in my URL when I enter the homepage?
This should remove public from the url.
RewriteRule ^(.*)$ public/$1 [L]
I am not sure if this should go above
# Handle Front Controller...
or within it? Maybe try either one and see if either work?
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ public/$1 [L]
RewriteRule ^ index.php [L]
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
source

Redirect to index Codeigniter

I'm having problem with redirecting.
How do i redirect localhost/volleyball to localhost/volleyball/index.php?
because it displays my directory i want it to point to index.php. Btw, i'm using Codeigniter2.2
here's my .htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /volleyball/
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
i got the answer, i added:
DirectoryIndex index.php

Codeigniter No input file specified

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]

Resources