SO I set up https to work on my site. the main page works. https://mysite.com but when you try to go to a sub folder like https: //mysite.com/join you receive the following error.
Not Found
The requested URL /join/index.php was not found on this server.
Apache/2.2.8 (CentOS) Server at mysite.com Port 443
It's as if it can't understand codeigniter. Below is my htaccess files.
RedirectMatch 404 /\\.git(/.*|$)
RewriteEngine On
Options +FollowSymLinks
RewriteBase /
RewriteCond $1 !^(index\.php|images|img|js|css)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https: //%{SERVER_NAME}%{REQUEST_URI} [R=301]
ErrorDocument 404 /system/error/404page.html
I doubled check the ssl virtualhosts with several other developers and it is set up right. It's weird that the home page works and nothing else. I'm guess it is because the home page has the codeigniter index.php to look at.
I set up the base URL as https://mysite.com.
Is there some settings in codeIgniter that I am missing?
I figured it finally.
in the httpd.conf I had to change this:
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
To this:
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
I knew it was something this small and annoying. Thanks for the help guys!
Change this line :
RewriteRule ^(.*)$ index.php?/$1 [L]
to :
RewriteRule ^(.*)$ /index.php?/$1 [L]
The .htaccess would otherwise be redirected relatively to a index.php in the join folder, which off course is not there.
Related
I've little to no experience working with Zend Framework 1 . Recently I was asked to make some changes to a sites functionality. So I decided that I would set up a local instance of the site to work on before deploying the changes to the live site.
The problem I am having is that when I go to the following url which is my local instance of the site: http://mysite.tld I am redirected to https://mysite.ie and I cannot figure out why.
Is it something to do with the htaccess file? because I removed the contents of this file in order to see if it had any impact and no joy.
Which made me thing that perhaps in Zend there is some setting which controls the environment?
This is my vhosts file on WAMP:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "C:\wamp\www\mysite.tld\public
ServerName mysite.tld
ErrorLog "logs/mysite.tld"
CustomLog "logs/mysite.tld" common
<directory "C:\wamp\www\mysite.tld\public">
Options Indexes FollowSymLinks
AllowOverride all
Order Allow,Deny
Allow from all
Allow from 127.0.0.1
</directory>
</VirtualHost>
This is my htaccess file
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://www.mysite.tld/$1 [L,R=301]
RewriteCond %{HTTP_HOST} !^www\.mysite\.tld$ [NC]
RewriteRule ^(.*)$ https://www.mysite.tld/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
If you require any more details from the project I can post them here, I'd appreciate any help as I am at a loss as to whats going on.
The following rule performs the redirect from http to https equivalent
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://www.mysite.tld/$1 [L,R=301]
This one redirects to www.mysite.tld if domain name is not already that one
RewriteCond %{HTTP_HOST} !^www\.mysite\.tld$ [NC]
RewriteRule ^(.*)$ https://www.mysite.tld/$1 [L,R=301]
If you're running it locally, you should comment those 4 lines of code.
Then, you have to clear your browser's cache to see it working (because your old rules are now in cache).
First of all, i'm new to FuelPHP, so it will be something very easy but i can't find the answer on the internet so i'm hoping that you guys can help me.
The thing is that i'm following THIS tutorial about FuelPHP.
I've setup wamp with an virtial directory in D:\www_ander\webshop. That is the root with the .htaccess and the index.php and the folder assets
I've got the fuel folder in the folder www_ander.
I've did what the tutorial said ( Edit the config / autoload, create the files and database ) with the following command ( i ran this in command promt from the folder D:\www_ander )
php oil generate scaffold messages name:string message:text
php oil refine migrate
I don't get any errors, and the database is created succesfully. But when i go to my website (this is localhost, i've edidted the host file of windows ):
http://webshop.nl/messages/
I get an 404, Not Found page. I even tryed it with /index/ appended to the URL, but that didn't work also.
So my question is, what did i wrong? Why isn't this working as it should?!? Is my URL wrong or is it another issue?
Mayby inrellevant, but here is the .htaccess file:
# Multiple Environment config, set this to development, staging or production
# SetEnv FUEL_ENV production
<IfModule mod_rewrite.c>
# Make sure directory listing is disabled
Options +FollowSymLinks -Indexes
RewriteEngine on
# NOTICE: If you get a 404 play with combinations of the following commented out lines
#AllowOverride All
#RewriteBase /wherever/fuel/is
# Restrict your site to only one domain
# !important USE ONLY ONE OPTION
# Option 1: To rewrite "www.domain.com -> domain.com" uncomment the following lines.
#RewriteCond %{HTTPS} !=on
#RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
#RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
# Option 2: To rewrite "domain.com -> www.domain.com" uncomment the following lines.
#RewriteCond %{HTTPS} !=on
#RewriteCond %{HTTP_HOST} !^www\..+$ [NC]
#RewriteCond %{HTTP_HOST} (.+)$ [NC]
#RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L]
# Remove index.php from URL
RewriteCond %{HTTP:X-Requested-With} !^XMLHttpRequest$
RewriteCond %{THE_REQUEST} ^[^/]*/index\.php [NC]
RewriteRule ^index\.php(.*)$ $1 [R=301,NS,L]
# Send request via index.php (again, not if its a real file or folder)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# deal with php5-cgi first
<IfModule mod_fcgid.c>
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
<IfModule !mod_fcgid.c>
# for normal Apache installations
<IfModule mod_php5.c>
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
# for Apache FGCI installations
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [QSA,L]
</IfModule>
</IfModule>
</IfModule>
------ UPDATE ------
I'm still looking for the answer, but i've already found an workaround. When i visit http://webshop.nl/index.php/messages/ it does work. So it seems like the .htaccess isn't fully working. But as far as i see, it should work. So do you guys know what could be wrong?
I've figured out what the problem was. Id had to do with my virtual host setup.
The thing is that i didn't specify to allow overides. So after i inserted this part in my virtual host file, it worked:
<Directory "D:\www_ander">
AllowOverride All
</Directory>
So the whole virtual host file now looks like this:
<Directory D:\www_ander\>
Order Deny,Allow
Allow from all
</Directory>
<VirtualHost *:80>
DocumentRoot "D:\www_ander"
ServerName webshop.nl
ServerAlias www.webshop.nl
<Directory "D:\www_ander">
AllowOverride All
</Directory>
</VirtualHost>
Hello I am using the following htaccess
<IfModule mod_rewrite.c>
Options +FollowSymLinks
Options -MultiViews
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
For doing the laravel routing.
When I surf to example localdevurl/public/users I get the following error ( 404 )
Not Found
The requested URL /Users/username/Sites/sitefolder/public/index.php/user was not found on this server.
But as u see it shows the index.php in the error. When I put index.php in my url it does work indeed. I have turned on everything in my apache config.
httpd.conf
Can anyone see what I am doing wrong here?
In your .htaccess file, you are passing the request after the index.php part, instead of allowing laravel routing system to process it, this is:
RewriteRule ^(.*)$ index.php/$1 [L]
should be as the original .htaccess
RewriteRule ^ index.php [L]
I had the same problem with the index.php part, this is how I solved: There is a problem when you have userdir module enabled, which it seems to be the case based on the URL of the error message.
Possible solutions:
Create a symlink in the webserver folder to the public laravel project folder of the user web directory. e.g.: # ln -s ~/public_html/mylaravel4/site/public/ /var/www/mycoolsite
Then you can access http://localhost/mycoolsite
Replace RewriteCond and RewriteRule lines with this: FallbackResource /index.php
Make sure you have AllowOverride set to All instead of None for you particular vhost, and also set Order allow, deny rather than Order deny, allow in httpd.conf.
AllowOverride all
Order allow, deny
I know this question is more appropriate for Server Fault but unfortunately I was banned for poor quality questions (I was down voted on 2-3 questions I asked.) So the next best place to ask these questions are here.
I have two problems related to CodeIgniter routing.
The first problem is that I can't seem to get rid of index.php in the url. I followed the instructions on how to remove it. I have the following mod rewrite code in my .htaccess file (see below) at the root of my WAMP server (CI is located at the root, not in its own folder). I have uncommented this line in httpd.conf file LoadModule rewrite_module modules/mod_rewrite.so. I deleted index.php from $config['index_page'] = "index.php";. And I restarted all WAMP services.
My second problem is that I have a controller called search and a method called index. I would like to change the resultant URL from http://localhost/index.php/search/index to http://localhost/search/whatever_im_searching_for. I tried the following custom route in my routes.php file but it did not work: $route['search/(.*)'] = "search/$1";
RewriteEngine On
# Put your installation directory here:
# If your URL is www.example.com/, use /
# If your URL is www.example.com/site_folder/, use /site_folder/
RewriteBase /
# Do not enable rewriting for files or directories that exist
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
# For reuests that are not actual files or directories,
# Rewrite to index.php/URL
RewriteRule ^(.*)$ index.php/$1 [PT,L]
I am struggling to understand the code in .htaccess and on how to use CI's custom routing. Any assistance will be greatly appreciated. Thank you in advance.
EDIT 1
Edit your htaccess like this:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_URI} ^LoginTut.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond $1 !^(index\.php|images|table-images|js|robots\.txt|css|captcha)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>
To have your searchterms in the url you can look at this:
https://stackoverflow.com/a/12070284/1379394
Second problem:
$route['search/(:any)'] = "search/index/$1";
Check Apache's default config file. On WAMP it's probably in
<WAMPSERVER_HOME>\bin\apache\Apache2.2.xx\conf
If it looks like this:
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
then change both:
AllowOverride None
to:
AllowOverride All
I had the same problem and I fixed only by write in my .htaccess:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ index.php/$1 [L]
and it's working perfectly.
I have a custom MVC app, where in it used IndexController naming convention, which I have built on WAMP. Today i tried it to put in to Linux (LAMP).. Strangely, it is giving error "page not found". Can anybody help. I am not good at mod rewrite,
Following is the code
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?request=$1 [L,QSA]
URL is
http://hostname/mvc/incident/add
Error is The requested URL /app01/users/public_html/mvc/index.php was not found on this server.
You need to put a / before index.php and some other stuff. Look at the example I got from Wordpress's one.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
Try either adding:
RewriteBase /mvc/
just under the RewriteEngine on directive, or add a leading slash to index.php:
RewriteRule ^(.*)$ /mvc/index.php?request=$1 [L,QSA]
Hi I solved this issue by using error redirecting functionality. I put following code in my .htaccess file
ErrorDocument 403 /~renjith/mvc/index.php
ErrorDocument 404 /~renjith/mvc/index.php
and in index.php file i used, $_SERVER['REQUEST_URI'] to get thr URL with query strings
I think that ./htaccess configuration is correct. I solved it simply by adding this directive to my apache2.conf file on debian.
<Directory /var/www/html/your_app_folder>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted</Directory>