Please login or register.

Login with username, password and session length
Advanced search  

News:

You need/want an older version of sNews ? Download an older/unsupported version here.

Author Topic: .htaccess?  (Read 3429 times)

gis

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 77
    • Wort|ge|fecht, das
.htaccess?
« on: May 31, 2007, 12:38:42 am »

With my current running sNews 1.5.31 install I encounter the following problem: whenever I create a subfolder (with a different index.php/.html) in my root directory and point my browser there, it opens the default index.php from the root. I suspect, it's my .htaccess, which looks like this:

Code: [Select]

    php_value session.use_trans_sid 0

RewriteEngine On
#RewriteBase /sNews15
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*) $1 [L]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ index.php?category=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?category=$1 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z_]+)/([^/]+) index.php?category=$1&title=$2 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z_]+)/([^/]+)/([^/]+)/ index.php?category=$1&title=$2&commentspage=$3 [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9_-]+)/([0-9]+)/ index.php?category=$1 articlespage=$2 [L]
Any suggestions?
Logged
Nah, we anarchists don't believe in coercive orthography.

Ken Dahlin

  • Full Member
  • ***
  • Karma: 30
  • Posts: 139
    • http://www.kendahlin.com/
.htaccess?
« Reply #1 on: May 31, 2007, 01:00:59 am »

Try creating an .htaccess file in the subfolder you create and specify RewriteBase. This should override your root .htaccess file.

Code: [Select]
<IfModule mod_php4.c>
    php_value session.use_trans_sid 0
</IfModule>
RewriteEngine On
RewriteBase /yoursubfoldername
« Last Edit: September 12, 2007, 12:45:33 am by Ken Dahlin »
Logged

gis

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 77
    • Wort|ge|fecht, das
.htaccess?
« Reply #2 on: May 31, 2007, 08:28:12 am »

Thanks, this works!
Logged
Nah, we anarchists don't believe in coercive orthography.

Keyrocks

  • Doug
  • ULTIMATE member
  • ******
  • Karma: 449
  • Posts: 6020
  • Semantically Challenged
    • snews.ca
.htaccess?
« Reply #3 on: May 31, 2007, 04:03:07 pm »

Can you not do this within the existing .htaccess file... by un-commenting the existing ReqriteBase string (remove the #-sign) and replace "sNews15" with the name of your sub-folder? You do not want to over-ride anything in the default .htaccess file, and it must be in the same location as the rest of your snews files and folders in order to properly create the SEF URLs for all your site's pages.

Quote

    php_value session.use_trans_sid 0

RewriteEngine On
RewriteBase /sNews15
Logged
Do it now... later may not come.
-------------------------------------------------------------------------------------------------
sNews 1.6 MESU | sNews 1.6 MEMU

gis

  • Jr. Member
  • **
  • Karma: 0
  • Posts: 77
    • Wort|ge|fecht, das
.htaccess?
« Reply #4 on: May 31, 2007, 04:35:09 pm »

What actually does the RewriteBase /folder line do? I was going to have my sNews site in the root dir (with snews.php in a subfolder named "php") and to install some other CMS in another subfolder.
Logged
Nah, we anarchists don't believe in coercive orthography.

Joost

  • Guest
.htaccess?
« Reply #5 on: May 31, 2007, 05:43:06 pm »

Quote from: gis
What actually does the RewriteBase /folder line do? I was going to have my sNews site in the root dir (with snews.php in a subfolder named "php") and to install some other CMS in another subfolder.
Mod_rewrite describes the path to a  file. Therefore it has got to know where the path starts. It cannot say 'second folder on the left and then the third on your right' if it doesn't have a starting point.:)
 '/sNews'  says: We start in de subfolder 'sNews, which is located directly under de root.'
When you are on shared hosting, this of course not the real root. The server administrator has put  similar directives in a file for all websites hosted on the server. These directives could have paths like this:

home/sites/webhosting/uvmb/uvmb/phpincludes:/home/sites/webhosting/vbp

We don't have to bother about that, as the server-admin has taken care of that. We on our part make sure to let the system know where the cms is located , through a directive in .htaccess.
 :)
When index.php is in the root , I leave the directive commented (#). The index.php is called for through the url. index.php will call snews.php.
Logged

Ken Dahlin

  • Full Member
  • ***
  • Karma: 30
  • Posts: 139
    • http://www.kendahlin.com/
.htaccess?
« Reply #6 on: June 01, 2007, 02:33:31 am »

Yeah, that's what I do too. In our case, it is proper to rewrite the base in the particular directory we put our secondary CMS in, that way calling /index.php or /index.html doesn't fall back to your real root directory.


Quote from: gis
What actually does the RewriteBase /folder line do? I was going to have my sNews site in the root dir (with snews.php in a subfolder named "php") and to install some other CMS in another subfolder.
Logged