CodeIgniter Forums
Forum Software and CI Htaccess - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forum-21.html)
+--- Thread: Forum Software and CI Htaccess (/thread-11047.html)



Forum Software and CI Htaccess - El Forum - 08-24-2008

[eluser]Bl4cKWid0w[/eluser]
I am developing a website with CodeIgniter. My forums are in the same directory as the root of CI. Is there any way to turn off htaccess in a certain directory? I am using SMF.


Forum Software and CI Htaccess - El Forum - 08-24-2008

[eluser]Sarre[/eluser]
Add a blank htaccess file to that directory?


Forum Software and CI Htaccess - El Forum - 08-24-2008

[eluser]Bl4cKWid0w[/eluser]
Tried it. Does not work. This is my directory set up.

--htdocs
--codeigniterproject
--forums
--forum files

I go to install the forum but the CI 404 error page comes up.


Forum Software and CI Htaccess - El Forum - 08-24-2008

[eluser]Pascal Kriete[/eluser]
Make sure the forums directory is not included in the rewrite - could you post your htaccess code?


Forum Software and CI Htaccess - El Forum - 08-24-2008

[eluser]Bl4cKWid0w[/eluser]
# Deny OR Allow Folder Indexes.
# Since we disable access to PHP files you
# can leave this on without worries.
# OR better yet, create a .htaccess file in
# the dir you want to allow browsing and
# set it to +Indexes
Options -Indexes

Options +FollowSymLinks

# Set the default file for indexes
DirectoryIndex index.php

<IfModule mod_rewrite.c>
# mod_rewrite rules
RewriteEngine on

# The RewriteBase of the system (if you are using this sytem in a sub-folder).
# RewriteBase /CodeIgniter_1.6.3/

# This will make the site only accessible without the "www."
# (which will keep the subdomain-sensive config file happy)
# If you want the site to be accessed WITH the "www."
# comment-out the following two lines.
# RewriteCond %{HTTP_HOST} ^www\.site\.com$ [NC]
# RewriteRule ^(.*)$ http://site.com/$1 [L,R=301]

# If a controler can't be found - then issue a 404 error from PHP
# Error messages (via the "error" plugin)
# ErrorDocument 403 /index.php/403/
# ErrorDocument 404 /index.php/404/
# ErrorDocument 500 /index.php/500/

# Deny any people (or bots) from the following sites: (to stop spam comments)
# RewriteCond %{HTTP_REFERER} nienschanz\.ru [NC,OR]
# RewriteCond %{HTTP_REFERER} porn\.com
# RewriteRule .* - [F]
# Note: if you are having trouble from a certain URL just
# add it above to forbide all visitors from that site.

# You can also uncomment this if you know the IP:
# Deny from 192.168.1.1

# If the file is NOT the index.php file
RewriteCond %{REQUEST_FILENAME} !index.php
# Hide all PHP files so none can be accessed by HTTP
RewriteRule (.*)\.php$ index.php/$1

# If the file/dir is NOT real go to index
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [QSA,L]

</IfModule>

# If Mod_ewrite is NOT installed go to index.php
<IfModule !mod_rewrite.c>
ErrorDocument 404 index.php
</IfModule>


Forum Software and CI Htaccess - El Forum - 08-25-2008

[eluser]Pascal Kriete[/eluser]
Hmm, the only thing that I can see that might do it is the first RewriteRule - disabling all php files. Try commenting out those two lines. Beyond that, I'm clueless Sad .


Forum Software and CI Htaccess - El Forum - 08-25-2008

[eluser]Adam Griffiths[/eluser]
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|forum|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

This will map everything to the index.php file, except for the folder forum, and robots.txt.


Forum Software and CI Htaccess - El Forum - 08-26-2008

[eluser]Bl4cKWid0w[/eluser]
Thanks, imparo, your suggestion fixed the problem.


Forum Software and CI Htaccess - El Forum - 08-27-2008

[eluser]Xeoncross[/eluser]
I wrote that code using the MVC approch that the ONLY file a user will ever access is the Index.php file that will load whatever Controller will need.

Blogs (wordpress), Forums, and every other script out there uses hundreds of different php files for different pages. So that is why the above .htaccess file didn't work for the forum.