I have created a login page using codeigniter framework.it works well.
After install apachi,mySql and php again my website login is not working.
I can go to "http://localhost/test/" and login button is there.
After The requested URL /test/user/user/login was not found on this server.When I click the login button redirect to the page "http://localhost/test/user/user/login" and it says "The requested URL /test/user/user/login was not found on this server"
How can I solve this?
It works well before I format the computer and install php again.
sloved after changing AllowOverride None to AllowOverride All in /etc/apache2/sites-enabled/000-default .
I have had a lot of problems trying to fix this issue and finally I have figured out that without changing index.php field within the config.php file, you have to specify the address like this; http://localhost/codeigniter_folder_name/index.php?/controller_name
This has solved it for me.
Your .htaccess file maybe inside the application folder. Move it outside the application folder, also ensure to re-write the .htaccess file as follows:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
Why you have used user twice like http://localhost/test/user/user/login. Here, user is the name of the controller. So the url should be like http://localhost/test/user/login. If you are not using htaccess file ie, mod_rewrite is not enabled, then the url should be like http://localhost/test/index.php/user/login
Related
Currently, a user's timeline can be accessed on my site using localhost/dateapp/timeline?profile=user1571502747. Here user can later manually change their username from user1571502747 to anything they like for easy access. Now what I want is if someone opens localhost/dateapp/user1571502747 (or mysite.com/user1571502747 when live), it automatically redirects and opens the timeline of user user1571502747 or say it redirects to localhost/dateapp/timeline?profile=user1571502747. But I am not being able to figure out a way to do so. Currently, when trying to access that displays no page with page not found browser error. Of course I have haven't put anything for it yet so its natural to get this error. Can anybody guide me on doing this? Facebook does this, for reference. Thanks in advance.
UPDATE: If anything needs to be done in .htaccess file then my current .htaccess has the following.
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.php [NC,END]
You can use .htaccess for this.
Try adding this to your .htaccess file in your root directory
RewriteEngine On
RewriteRule ^([^/]*)$ /timeline?profile=$1 [L]
I have a problem after uploading my website over test server.
The site is done under symfony, and putting it on my server, the url to access it is the following one:
http://XX.XXX.XXX.XXX/nameOfMySite/app.php
The problem is that I would like to access it with the following URL for example: http://XX.XXX.XXX.XXX/nameOfMySite
because for the moment all the links that I put, like the page of connection, are innaccessible.
In local I do http://localhost/login and not http://localhost/app.php/login
On my server I am forced to do
http://XX.XXX.XXX.XXX/nameOfMySite/app.php/login
to access the page.
Is there a configuration to remove "app.php" or "app_dev.php" please?
I am lost, because apart from the homepage, there is no longer any page of my website is accessible.
Thank you in advance for your answers
I had this issue few days ago. I have solve this changing my .htaccess file. All I ve done was implementing rewrite rule. See below:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ app.php/$1 [QSA,L]
</IfModule>
Hope this will solve your problem too. Good luck
I have just had a problem with a Codeigniter site where, after the hosting company had migrated files to a new server, I could no longer navigate away from the home page. I Googled a forum with a similar issue and the answer was my htacess file. It was previously like this:
Options FollowSymLinks
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
and the given solution was to add a '?' character after 'index.php'. I did that and everything then worked OK.
I have tried hard to understand htaccess code and syntax and read many documents but they might as well be written in Chinese for all the sense I can get out of them. So can anyone explain why that additional '?' was needed and what it did? And if you can explain the rest of the code too I would be eternally grateful!
Your new host's php handler or webserver isn't setup to handle PATH INFO, or the stuff after the script (index.php) that's part of the actual path, e.g.
/index.php/this/is/part/of/the/path_info
The index.php script is executed, and everything after can be fetched via "PATH_INFO". If the server doesn't handle this, code igniter can optionally handle the path passed in as the QUERY STRING. Which are parameters that follow a ?.
None of this has anything to do with htaccess or mod_rewrite. It's just the way URLs and handlers work.
I am new to codeigniter frame work. I have installed CodeIgniter 2.1.4 version. I set up the application and system path in my local wamp server. The front end opens fine.
But when i try to open the admin i.e http://siteurl/CodeIgniter_2.1.4/admin
it shows as 404 not found. In application >> controllers >> admin.php is found (Hope this is for admin panel)
Then why it shows as 404 not found. Shall i made any setup for admin url? Please help me. Thanks
You will need multiple things in place in order to achieve this:
Set the $config['index_page'] to an empty string in application/config/config.php
You will have to rewrite the requests coming in, for example with apache you will need to have rewrite rules like this:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1/ [L,QSA]
You can put them into a file called .htaccess next to the index.php (your webserver need to be configured to support these kind of files for this to work)
You will have to have a function called index inside your admin.php, inside a class called Admin.
I'm having a hardtime on this part. Well I created a login page using codeigniter wherein the whole path would be http://localhost/CodeIgniter_2.1.3/index.php will be rewritten into http://localhost/login using .htaccess. Well it works just fine but the problem is after I made a successful login and the page redirects to next page using redirect('next_page'); since the URL would be http://localhost/CodeIgniter_2.1.3/index.php/next_page instead of http://localhost/next_page. I also created a rewriterule for that part :
RewriteRule ^events$ /CodeIgniter_2.1.3/index.php/events [L,NC]
and whenever I key in the http://localhost/next_page in the addressbar the page would appear just fine (since I haven't applied any rules on login and on this page.) I also tried using redirect('http://localhost/events'); this also works just fine but still I know this is not the real solution for this. Oh by the way my .htaccess exists on the www folder of wampserver. Any way to solve this?
First of all your domain ROOT folder should be the codeigniter folder
forexample
c:/www/codeigniter_2.1.3/
just move the files from the codeigniter_2.1.3 to your root folder OR make the codeigniter folder ROOT.
Then use just normal .htaccess rewrite as:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
RewriteRule ^(.*)$ index.php/$1 [L]
And use the Codeigniter ROUTER to make your pages as you want them
example:
$route['login'] = 'welcome/login';
Will set http://localhost/login page to be loaded from the Welcome controler Login function.
You can set $routes at your routes.php in the config folder.
P.S> If you want not to see index.php on each page check your Config/config.php for the index_page and make it blank.
You might just want to add virtual host to your localhost. here is one step by step explanation on how to do that.
now all you have to do is create an .htaccess file inside your CodeIgniter_2.1.3 folder that will remove only the index.php in the url.