I've just transferred a project of mine to the web and I have a file called "circlecrop.php" that's located in the root directory of where all the CodeIgniter files are. This php script basicall just makes any image with circlecrop.php?path=img cropped to a circle, very simple and it works fine locally.
This works perfectly fine locally.
I'm getting the following error:
Failed to load resource: the server responded with a status of 403 (Forbidden)
I can't access circlecrop.php directly even though I've got it set to 777, I haven't anything set within my routes in CodeIgniter I'm not sure it's needed?
Complete htaccess file
RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|circlecrop\.php|images|js|profile_pictures|fonts|stylesheets|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
I've done some searching and can't seem to find anything, my only thought is that I need a way to directly access circlecrop.php and it will work. Any help is greatly appreciated!
Edit: I've updated the url that has the errors, maybe that's more helpful.
You need to include if your website placed on root directory
RewriteBase /
If it place in test folder for example use this.
RewriteBase /test/
simply use site_url() on every link and action instead of base_url().
This worked for me:
I replace .htaccess content by the following:
RewriteEngine on
RewriteCond $1 !^(index.php|application/themes|application/theme_path|images|assets|robots.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
Update your base_url according to your live host in config.php
$config['base_url'] = 'SET YOUR SITE URL HERE';
config.php is located in /application/config
Related
Recently I uploaded a website which created using codeigniter framework into plesk. Inside the c-panal I changed the document root into httpdocs/public_html/cliftonhotel.ae, and I uploaded the files using FTP into the same. I changed the base_url into
$config['base_url'] = 'http://cliftonhotel.ae/';
The problem is if I enter the web address it loads fine(The home page), but the other menus are not working, they shows a 404 page not found error.
[http://cliftonhotel.ae/][1]
this is the site. What is the solution, thankyou.
Do some changes, hope it's work
// .htaccess file
RewriteEngine on
RewriteCond $1 !^(index\.php|public|\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1
// config.php
$config['index_page'] = ' ';
It seems that the links you have created are missing index.php
For example: http://cliftonhotel.ae/index.php/home/about works
but http://cliftonhotel.ae/home/about does not.
So you have to either change the links or edit your .htaccess for url rewriting
Let me inform you this first. This application is working pretty fine on live server currently, however we needed to move it to a different server with a different domain.
Issue is: It gives 404 error on every other page except for index. Loading through index.php works fine.
For an example:
www.test.com/main/login //This gives 404 error
www.test.com/main/index.php/login //This loads fine
Because everything is working fine currently, I made changes only in $config['base_url'] and in database config file. There have been no other changes in any of the files.
Also, this solution provided by somebody in a different questions is already tried out and this doesn't work. Solution is to create .htaccess file with below code & setting $config['index_page']='' :
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Current server is VPS & provider is GoDaddy. New server is Shared hosting and provider is GoDaddy. I'm not getting the root cause of this happening, can somebody point out to the possible solution?
EDIT
I'm attaching a screenshot for an error, it's not typical 404 error page. In case this helps.
For Godaddy, you need to alter this 2 things.
In your .htaccess file, replace
RewriteRule ^(.*)$ index.php/$1 [L]
With the following:
RewriteRule ^(.*)$ index.php?/$1 [L]
Then is your application/config/config.php :
$config['index_page'] = '';
Both this changes should help you resolve your issue.
The problem I m facing that I am receiving an id from url and showing it simply
http://localhost/test/?username=bingo123
Its working fine and shows the result
But I want that I should be able to write like
http://localhost/test/bingo123 .
I tried to make .htaccess file and but it does not work and shows
The requested URL /test/bingo123 was not found on this server
Rewriteengine on
Rewriterule ^([a-zA-z]+)$ index.php?username=$1
I want to know that what should i change make in .htaccess file or some other settings in Wamp to run the script and where should I save .htaccess so that It works fine .Here "test" the folder name where all php files are there and how to save the .htaccess file as it does not allow it to save without first name.
Thanks in advance.
Try like this
RewriteEngine On
RewriteRule ^test/([^/]*)$ /test/?username=$1 [L]
Myabe Helpful
RewriteRule ^test/([a-zA-Z]+)$ test.php?username=$1 [L]
RewriteRule ^test/([a-zA-Z]+)/([a-zA-Z]+)$ test.php?username=$1/$2 [L]
RewriteRule ^test/([a-zA-Z]+)/([0-9]+)$ $ test.php?username=$1[L]
RewriteEngine On
RewriteRule ^test/([a-zA-Z0-9-=_.]+)$ test.php?username=$1 [L]
I am working on my own PHP Framework. I am currently developing it on localhost and everything related to project is in subfolder called RuddyPhpFramework, so the path look like this:
localhost/RuddyPhpFramework/
In that folder, I do have index.php, the init point of whole Framework. I am currently working on my own router, but I have a two problems. First, in Apache's htaccess file a have this:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) RuddyPhpFramework/index.php [L]
So whenever someone acces a page like this:
localhost/RuddyPhpFramework/something/smtelse/
The index.php will init the application and echo a path for me, which is:
[path] => /RuddyPhpFramework/something/smtelse/
But that is not excatly what I want. What I want is to get a relative path to subfolder (I don't know if I am explaining this correctly), for example:
[path] => /something/smtelse/
And another problem is that I want to setup the htacces so the last line would look something like this:
RewriteRule (.*) index.php [L]
So it will go for the index.php in the folder where is the htaccess file (/RuddyPhpFramework/index.php) and not /index.php, without specifying the foler, because if someone else will be using the framework, he might have it in a folder with different name.
first please stop we have enouth frameworks already. Now regarding your question. Your project is in localhost/RuddyPhpFramework so htaccess read url from first / so he skips localhost because it's domain and taiks uri witch starts from /
so you project setup is incorrect. what you could try not shure 100%:
RewriteEngine On
RewriteBase /RuddyPhpFramework/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) index.php [L]
please try it. and say did it helped.
I am very new to CodeIgniter so obviously I have problem with the most basic things. I have recently tried to implement a website on local environment. I am using WAMP and the website is in www/public_html. Now the website is working on my localhost but if I try to navigate to any other page from the default (default_controler) it returns not found like
The requested URL /public_html/signin/login/ was not found on this server
I assumed that the website was designed to resolve its path related problems by itself. I am obviously missing something very basic.
I have changed the base_url in the config.php file by the way.
$config['base_url'] = 'http://localhost/public_html/';
I have no clue where else the base_url are or where to change it. Any help will greatly appreciated.
Zain
You are getting this problem because you don't have your .htaccess file configured correctly. At the document root in your .htaccess file you need the following
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
In your config.php you will need to do
$config['index_page'] = '';
You also need to make sure you have mod_rewrite enabled
ther is a problem with your index.php. check this line
$config['index_page'] = 'index.php';
if it works u have to add an ht access file to remove index.php from ur url
there are a lot of code for .htaccess file on web try using one that suits you