Installing AD in a subdirectory

Get answers to common Article Dashboard installation questions and tips on customizing the script for your site.

Installing AD in a subdirectory

Postby GardenSimply » Wed Oct 15, 2008 9:51 am

Question:
I was just wondering, which files would I have to change to make Article Dashboard work when it is its own sub directory on my website, not the site root?


Answer by Article-Buzz:

For installation in a subdirectory you need to add a rewriteBase to the .htaccess

RewriteEngine On
RewriteBase /subdirectory

And add the subdirectory to your paths in setup.php

Code:
Code: Select all
$base_path       = "/home/user/public_html/subdirectory";
$base_url        = "http://www.yourdomain.com/subdirectory";
$admin_path      = "/home/user/public_html/subdirectory/admin";
$admin_url       = "http://www.yourdomain.com/subdirectory/admin";


That should be all that is required.

Thank you so much article buzz! That fixed it right up. I did have to add one more thing though:

In your .htaccess, Instead of


Code: Select all
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1  [R,L]


put

Code: Select all
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/subdirectory/$1  [R,L]



A new question to the above...

Hi
I have also installed in the subdirectory called /articles.

Full URL is http://www.sanchanworld.com/articles/ . Here i tried everything like adding RewriteBase and change in setup.php . but still i am getting the 500 internal server error.

my modified .htaccess is as follows.

Code: Select all
# -FrontPage-
 
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
 
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>


php_flag session.use_trans_sid off

RewriteEngine on

RewriteBase /articles

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST}  !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/articles/$1  [R,L]
 
RewriteRule ^profile\/([^\/]+)/([0-9]+)     publicprofile.php?name=$1&id=$2     
RewriteRule ^Category\/[^\/]+/([0-9]+)      index.php?catid=$1&mode=category   
RewriteRule ^Article/[^\/]+/([0-9]+)/?(.*)  article.php?id=$1&act=$2           
RewriteRule ^rss/[^\/]+/([0-9]+)            rssarticle.php?id=$1               
RewriteRule ^myarticles/(.*)$               index.php?mode=myarticles

RewriteRule ^(.*)topauthorslist/      topauthors.php?orderby=$1&ordertype=$2&namelike=$3&page=$4
RewriteRule ^(.*)popularlist/          populararticles.php?page=$2
RewriteRule ^(.*)searchresult/          indexser.php?page=$2


To make it run successfully, What else i can do


Added:
After going through this other information I found that we need to comment one line in .htaccess. ie,

php_flag session.use_trans_sid off
to
#php_flag session.use_trans_sid off

Now my articles site is running. But what was the use of this line. and what we lose or are there any issues if we run the site without this line?


Response: Putting a pound sign in front of the php flag comments it out in .htaccess If session.use_trans_sid is already off on your server setup, then it can simply be removed. If your server is running php5 it will have no effect or throw an error. It can be safely removed if not needed. htaccess cannot be used to control PHP5 settings on most server setups. It can work, but not on most shared environments. PHP5 must be run as an Apache module in order for such functionality to exist, but most upgraded servers run suexec or fastCGI. You would need to create a custom php.ini or contact your hosting support to see if any servers are running PHP5 as an Apache module. The easiest thing to do is delete it if you don't need it or turn on session.use_trans_sid off (if it is on) from a php.ini file.

I thought, like we use /* or // for commenting purpose in php in the same i assumed that # symbol indicates commenting. So what you suggest? Do i need to keep that line with # symbol or need to delete line itself?


Response:
The # instructs the server to ignore the line. Each line of comments requires it’s own #. (rather like php)

Examples:

# redirect section
# ban spammers by IP

Another thing you can do if you have a 'competing' .htaccess file in your root index (remember, .htaccess is recursive (meaning if you place the .htaccess file in your web root (the main folder of your web site) the directives and commands you place in the .htaccess file will have effect on all sub-folders) is add the below line to the ROOT .htaccess file...

RewriteRule ^articles/ - [L]

Where articles/ is the name of the directory that AD is installed in.
User avatar
GardenSimply
Admin
 
Posts: 208
Joined: Sat Sep 15, 2007 10:31 am
Location: Oklahoma

Re: Installing AD in a subdirectory

Postby Krasny » Wed Dec 24, 2008 10:22 am

I am trying to set up AD in the subdirectory /articles. Currently I have .htaccess in the root directory and again in the subdirectory /articles.

When I access /articles I see a .htaccess file displayed however it is not the one in my /articles directory or my root directory. Also 404 page not found errors on all files within the /articles

I am running a Word-Press website in the root directory of my site. This Word-Press application will not run if I change to RewriteEngine On

The setup.php includes the sudirectory

Code: Select all
$base_path       = "/home/mercmac0/public_html/articles";
$base_url        = "http://www.florida-ranch-farm-and-land-loans.com/articles";
$admin_path      = "/home/mercmac0/public_html/articles/admin";
$admin_url       = "http://www.florida-ranch-farm-and-land-loans.com/articles/admin";


Here is my server information:
Operating system Linux
Architecture i686
Apache version 1.3.41 (Unix)
PHP version 5.2.6
MySQL version 5.0.67-community

Here is my root .htaccess[/code]
Code: Select all
# -FrontPage-
 
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
 
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>
<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>

#php_flag session.use_trans_sid off

RewriteEngine Off

RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST}  !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1  [R,L]
 
RewriteRule ^profile\/([^\/]+)/([0-9]+)     publicprofile.php?name=$1&id=$2     
RewriteRule ^Category\/[^\/]+/([0-9]+)      index.php?catid=$1&mode=category   
RewriteRule ^Article/[^\/]+/([0-9]+)/?(.*)  article.php?id=$1&act=$2           
RewriteRule ^rss/[^\/]+/([0-9]+)            rssarticle.php?id=$1               
RewriteRule ^myarticles/(.*)$               index.php?mode=myarticles

RewriteRule ^(.*)topauthorslist/     topauthors.php?orderby=$1&ordertype=$2&namelike=$3&page=$4
RewriteRule ^(.*)popularlist/         populararticles.php?page=$2
RewriteRule ^(.*)searchresult/         indexser.php?page=$2 


Here is my /articles .htaccess
Code: Select all
# -FrontPage-
 
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
 
<Limit GET POST>
order deny,allow
deny from all
allow from all
</Limit>

<Limit PUT DELETE>
order deny,allow
deny from all
</Limit>

RewriteEngine On

RewriteBase /articles
RewriteCond %{HTTP_REFERER} !^$
RewriteRule \.(gif|jpg|js|css)$ - [F]
RewriteCond %{HTTP_HOST} .
RewriteCond %{HTTP_HOST}  !^www\. [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/articles/$1  [R,L]

RewriteRule ^profile\/([^\/]+)/([0-9]+)     publicprofile.php?name=$1&id=$2     
RewriteRule ^Category\/[^\/]+/([0-9]+)      index.php?catid=$1&mode=category   
RewriteRule ^Article/[^\/]+/([0-9]+)/?(.*)  article.php?id=$1&act=$2           
RewriteRule ^rss/[^\/]+/([0-9]+)            rssarticle.php?id=$1               
RewriteRule ^myarticles/(.*)$               index.php?mode=myarticles

RewriteRule ^(.*)topauthorslist/     topauthors.php?orderby=$1&ordertype=$2&namelike=$3&page=$4
RewriteRule ^(.*)popularlist/             populararticles.php?page=$2
RewriteRule ^(.*)searchresult/             indexser.php?page=$2
Krasny
 
Posts: 2
Joined: Thu Dec 04, 2008 3:47 pm

Re: Installing AD in a subdirectory

Postby GardenSimply » Fri Dec 26, 2008 1:10 am

A few points...

In your /public_html/ folder, the .htaccess file has RewriteEngine Off before any of the rewrite rules, so it is actually just sitting there not doing anything.

Wordpress does not ship with an .htaccess file so unless you have plugins that use them, you can simply remove it. You've overwritten it anyway!If you take it out, see what happens in /articles/

I would add this to the existing .htaccess in the articles/ folder so the .htaccess file cannot be viewed.

<Files .htaccess>
order allow,deny
deny from all
</Files>

Check your directory and make sure that the server did not rename .htaccess, .htaccess.txt .htaccess IS the file extension, not .txt
User avatar
GardenSimply
Admin
 
Posts: 208
Joined: Sat Sep 15, 2007 10:31 am
Location: Oklahoma


Return to Article Dashboard Installation and Customization

Who is online

Users browsing this forum: No registered users and 1 guest

cron