0

When I try and access channels in Expressionengin I get 404 pages...

A URL like http://www.nameofsite/news/index.php tells me 'The requested URL /news/index.php was not found on this server."

However when I set the template for the channel to be the homepage it works.

What would be the best way to figure out what the issue might be?

Does Expresssionengine use URL rewriting?

Update 1:

When I enter the following it works: nameofsite.com/index.php/news.index.php

Is there anyway to clean up the structure so it is: nameofsite.com/news

Update 2: I turned of the "template as home" option and nameofsite.com/index.php/news.index.php no longer worked. Still stumped.

The .htaccess code

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Removes index.php from ExpressionEngine URLs
    RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
    RewriteCond %{REQUEST_URI} !/system/.* [NC]
    RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

    # Directs all EE web requests through the site index file
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
9
  • What happens at nameofsite.com/index.php/news and nameofsite.com/news? – Stephen Callender May 15 '14 at 16:02
  • I get the Forbidden message at nameofsite.com/news and a when I go to nameofsite.com/index.php/news when removing the index.php using the htaccess – Dan Lee May 19 '14 at 12:33
  • Remove your .htaccess file for a moment and tell us what you see with those same links. Then add the contents of your .htaccess file to original question above. – Stephen Callender May 19 '14 at 14:16
  • I get a "Not Found" error message when removing the .htaccess for /news and the /index.php/news works but the template is set as the homepage. – Dan Lee May 19 '14 at 14:53
  • The problem is somewhere in your .htaccess file. Copy and paste the contents into your original question above. – Stephen Callender May 19 '14 at 15:17
1

I think you're not fully understanding how EE URL's work. Here's the gist.

If you do not use an .htaccess file:
The URL to view the template group NEWS and template file INDEX.HTML will be:
example.com/index.php/news/

If you do use an .htaccess file to remove the index.php part of the URL:
The URL to view the template group NEWS and template file INDEX.HTML will be:
example.com/news/

Note that the template file, if it is INDEX.HTML, does not need to be added to the URL.

However...

If you do not use an .htaccess file:
The URL to view the template group NEWS and template file VIEW.HTML will be:
example.com/index.php/news/view/

If you do use an .htaccess file to remove the index.php part of the URL:
The URL to view the template group NEWS and template file VIEW.HTML will be:
example.com/news/view/

There are plenty of questions and answers here about how to setup an .htaccess file to remove index.php. When you have that file ready, put it in the root directory of your site's domain.


BONUS: As Jonathan Waters noted above in the comments, the Site's Index Page under General Configurations is best left blank if you are using an .htaccess file to remove index.php.

1
  • Thanks for the clear instructions. However I follow your guidance following the .htaccess track and I get a "Forbidden - You don't have permission to access /news on this server." when accessing example.com/news/ – Dan Lee May 21 '14 at 10:28
1

First, to remove the first index, refer to the documentation here

Second, to access the index page of the template group, it is not index.php, you would simply go to http://www.nameofsite/news/ .

I do not know if you changed the name of your index template but it does not need the .php extension. Expressionengine templates are .html files (if they are synced ) even though they can have php in them.

5
  • I get the Forbidden message at nameofsite.com/news and when I go to nameofsite.com/index.php/news after removing the index.php using the htaccess – Dan Lee May 19 '14 at 12:34
  • What do you have set in your "Name of your site's index page" setting under general config? – Johnathan Waters May 19 '14 at 15:00
  • Name of site's index page is index.php – Dan Lee May 19 '14 at 15:42
  • Try leaving that field blank. – Johnathan Waters May 19 '14 at 18:06
  • That doesn't work. – Dan Lee May 20 '14 at 9:01
-1

Did you remember to activate the rewrite module on Apache?

$ a2enmod rewrite
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.