| :: |
| Author |
Message |
C@
Joined: 25 Jan 2007 Posts: 5
|
Posted: Thu Jan 25, 2007 9:17 am Post subject: .htaccess in a folder |
|
|
Is any way to make .htaccess file (simple mode v0.2.0) to work in a folder, e.g. folder /forum/ ?
I tried to put root-version of .htaccess (simple mode v0.2.0) inside folder forum/, but instead of /forum/forum1.html it returns 404 error while index page /forum/ works fine.
Any help is appreciated  |
|
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 13354
|
Posted: Thu Jan 25, 2007 11:57 am Post subject: Re: .htaccess in a folder |
|
|
And welcome
Usually, there is no real reason to put the phpBB's .htaccess in it's folder.
Unless you've got several hundreds of rewrtierules in the root's .htaccess, it's not a performance issue at all.
Especially if the other rewriterules are as efficient as the phpBB SEO ones (eg using the [L] flag and mentioning the path left and right parts).
Besides, running a single htaccess from root allow the use of rules that will be running on all folders without problems, like the www prefix redirection.
But, if you'd prefer to run it from the forum folder, you can.
You'd need to get rid of the folder names ("phpbb/") in the left part, should be enough.
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
C@
Joined: 25 Jan 2007 Posts: 5
|
Posted: Thu Jan 25, 2007 5:30 pm Post subject: Re: .htaccess in a folder |
|
|
Thank you for your prompt reply
Right now I have the following .htaccess in the folder /forum/:
| Quote: | RewriteEngine On
RewriteBase /
#########################################################
# PHPBB SEO REWRITE RULES #
#########################################################
# AUTHOR : DCZ http://www.phpbb-seo.com/
# STARTED : 01/2006
#####################################################
# FORUMS PAGES
########################
# FORUM PROTECTION RULE
# RewriteRule ^.*/([^/]+\.html)$ /index.php [R=301,L]
# CATEGORIES
RewriteRule ^cat([0-9]+)\.html$ /index.php?c=$1 [QSA,L]
# PAGINATED FORUM
RewriteRule ^forum([0-9]+)-([0-9]+)\.html$ /viewforum.php?f=$1&start=$2 [QSA,L]
# FORUM
RewriteRule ^forum([0-9]+)\.html$ /viewforum.php?f=$1 [QSA,L]
# PAGINATED TOPIC
RewriteRule ^topic([0-9]+)-([0-9]+)\.html$ /viewtopic.php?t=$1&start=$2 [QSA,L]
# TOPIC
RewriteRule ^topic([0-9]+)\.html$ /viewtopic.php?t=$1 [QSA,L]
# POST
RewriteRule ^post([0-9]+)\.html$ /viewtopic.php?p=$1 [QSA,L]
#PROFILES
RewriteRule ^member([0-9]+)\.html$ /profile.php?mode=viewprofile&u=$1 [QSA,L]
# END PHPBB PAGES
##################################################### |
and it doesn't work it kicks me to 404 error if I click on any forum's link (e.g.: forum/forum1.html) on the forum's index page
but everything's working fine if I put an appropriate code from your mod's package into root's .htaccess file. The reason why I need it in the folder /forum/: I already have mode rewrite functions in the root's .htaccess (for the rest of my site) and they are in conflict with your mode
in both above cases I turned off my already existing mode rewrite functions just to get a clear experiment. |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 13354
|
|
| Back to top |
|
 |
C@
Joined: 25 Jan 2007 Posts: 5
|
Posted: Thu Jan 25, 2007 5:56 pm Post subject: Re: .htaccess in a folder |
|
|
| Code: | | RewriteBase /forum/ | didn't make any difference
right now I have exact code of .htaccess in the folder /forum/ as it's in my previous message.
here is .htaccess code in the root: | Code: | php_value register_globals Off
php_value mbstring.func_overload 7
#RewriteEngine On
#RewriteCond %{REQUEST_FILENAME} -f [OR]
#RewriteCond %{REQUEST_FILENAME} -d
#RewriteRule .+ - [L]
#RewriteRule .* rewrite_name.php [L] |
this combination kicks me to 404 error if I click on any link on the forum's index page  |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 13354
|
Posted: Thu Jan 25, 2007 6:08 pm Post subject: Re: .htaccess in a folder |
|
|
if what's above is all your root's .htaccess content, try :
| Code: | php_value register_globals Off
php_value mbstring.func_overload 7
RewriteEngine On
RewriteBase /
#########################################################
# PHPBB SEO REWRITE RULES #
#########################################################
# AUTHOR : DCZ http://www.phpbb-seo.com/
# STARTED : 01/2006
#####################################################
# FORUMS PAGES
########################
# FORUM PROTECTION RULE
# RewriteRule ^.*/([^/]+\.html)$ /forum/index.php [R=301,L]
# CATEGORIES
RewriteRule ^forum/cat([0-9]+)\.html$ /forum/index.php?c=$1 [QSA,L]
# PAGINATED FORUM
RewriteRule ^forum/forum([0-9]+)-([0-9]+)\.html$ /viewforum.php?f=$1&start=$2 [QSA,L]
# FORUM
RewriteRule ^forum/forum([0-9]+)\.html$ /forum/viewforum.php?f=$1 [QSA,L]
# PAGINATED TOPIC
RewriteRule ^forum/topic([0-9]+)-([0-9]+)\.html$ /forum/viewtopic.php?t=$1&start=$2 [QSA,L]
# TOPIC
RewriteRule ^forum/topic([0-9]+)\.html$ /forum/viewtopic.php?t=$1 [QSA,L]
# POST
RewriteRule ^forum/post([0-9]+)\.html$ /forum/viewtopic.php?p=$1 [QSA,L]
#PROFILES
RewriteRule ^forum/member([0-9]+)\.html$ /forum/profile.php?mode=viewprofile&u=$1 [QSA,L]
# END PHPBB PAGES
##################################################### |
As you do not need to separate it, it's small
And delete you forum/ folder's .htaccess
and, if you get 404, try getting rid, as said in install, of the "/" before "forum/".
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
C@
Joined: 25 Jan 2007 Posts: 5
|
Posted: Thu Jan 25, 2007 6:21 pm Post subject: Re: .htaccess in a folder |
|
|
Dear dcz
as I already mentioned previously your mod works fine in the root, but I need my (commented for now): | Code: | #RewriteEngine On
#RewriteCond %{REQUEST_FILENAME} -f [OR]
#RewriteCond %{REQUEST_FILENAME} -d
#RewriteRule .+ - [L]
#RewriteRule .* rewrite_name.php [L] | together they don't work, this is the reason why I want your mod's .htaccess rules only in the folder /forum/ - actually this is the right way to do it because your mod is intended to work only with phpBB |
|
|
| Back to top |
|
 |
C@
Joined: 25 Jan 2007 Posts: 5
|
Posted: Thu Jan 25, 2007 6:51 pm Post subject: Re: .htaccess in a folder |
|
|
I fixed the problem myself now your mode works in the folder with its own .htaccess: | Code: | RewriteEngine On
RewriteBase /forum/
#########################################################
# PHPBB SEO REWRITE RULES #
#########################################################
# AUTHOR : DCZ http://www.phpbb-seo.com/
# STARTED : 01/2006
#####################################################
# FORUMS PAGES
########################
# FORUM PROTECTION RULE
RewriteRule ^.*/([^/]+\.html)$ index.php [R=301,L]
# CATEGORIES
RewriteRule ^cat([0-9]+)\.html$ index.php?c=$1 [QSA,L]
# PAGINATED FORUM
RewriteRule ^forum([0-9]+)-([0-9]+)\.html$ viewforum.php?f=$1&start=$2 [QSA,L]
# FORUM
RewriteRule ^forum([0-9]+)\.html$ viewforum.php?f=$1 [QSA,L]
# PAGINATED TOPIC
RewriteRule ^topic([0-9]+)-([0-9]+)\.html$ viewtopic.php?t=$1&start=$2 [QSA,L]
# TOPIC
RewriteRule ^topic([0-9]+)\.html$ viewtopic.php?t=$1 [QSA,L]
# POST
RewriteRule ^post([0-9]+)\.html$ viewtopic.php?p=$1 [QSA,L]
#PROFILES
RewriteRule ^member([0-9]+)\.html$ profile.php?mode=viewprofile&u=$1 [QSA,L]
# END PHPBB PAGES
##################################################### |
thank you for participation, dcz
one more question: what's the sacred purpose of this line? | Code: | | # RewriteRule ^.+/([^/]+\.html)$ /index.php [R=301,L] | why it's commented? |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 13354
|
Posted: Fri Jan 26, 2007 1:54 pm Post subject: Re: .htaccess in a folder |
|
|
Oh I see.
I just got rid of the commented lines, but I think :
| Code: | php_value register_globals Off
php_value mbstring.func_overload 7
RewriteEngine On
RewriteBase /
#########################################################
# PHPBB SEO REWRITE RULES #
#########################################################
# AUTHOR : DCZ http://www.phpbb-seo.com/
# STARTED : 01/2006
#####################################################
# FORUMS PAGES
########################
# FORUM PROTECTION RULE
# RewriteRule ^.*/([^/]+\.html)$ /forum/index.php [R=301,L]
# CATEGORIES
RewriteRule ^forum/cat([0-9]+)\.html$ /forum/index.php?c=$1 [QSA,L]
# PAGINATED FORUM
RewriteRule ^forum/forum([0-9]+)-([0-9]+)\.html$ /viewforum.php?f=$1&start=$2 [QSA,L]
# FORUM
RewriteRule ^forum/forum([0-9]+)\.html$ /forum/viewforum.php?f=$1 [QSA,L]
# PAGINATED TOPIC
RewriteRule ^forum/topic([0-9]+)-([0-9]+)\.html$ /forum/viewtopic.php?t=$1&start=$2 [QSA,L]
# TOPIC
RewriteRule ^forum/topic([0-9]+)\.html$ /forum/viewtopic.php?t=$1 [QSA,L]
# POST
RewriteRule ^forum/post([0-9]+)\.html$ /forum/viewtopic.php?p=$1 [QSA,L]
#PROFILES
RewriteRule ^forum/member([0-9]+)\.html$ /forum/profile.php?mode=viewprofile&u=$1 [QSA,L]
# END PHPBB PAGES
#####################################################
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule .+ - [L]
RewriteRule .* rewrite_name.php [L] |
will work from root. Alowing you to implement the www prefix redirection without trouble.
Then :
| Code: | | RewriteRule ^.+/([^/]+\.html)$ /index.php [R=301,L] |
is just a rule to redirect to index url like topic/title-txx.html, to prevent virtual folder injection.
It's an effort to make it impossible for anyone to trick our URLs, but this rewriterule is not useful anymore with the zero dupe, so that's why I left is commented, in case someone would need it.
You can delete the lien if you want  |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
Ľubor PR0

Joined: 13 Feb 2007 Posts: 52 Location: Slovakia,Bratislava
|
Posted: Mon Sep 03, 2007 10:54 am Post subject: Re: .htaccess in a folder |
|
|
| Code: | RewriteEngine On
RewriteBase /forum/
#########################################################
# PHPBB SEO REWRITE RULES #
#########################################################
# AUTHOR : DCZ http://www.phpbb-seo.com/
# STARTED : 01/2006
#####################################################
# FORUMS PAGES
########################
# FORUM PROTECTION RULE
# RewriteRule ^.*/([^/]+\.html)$ /forum/index.php [R=301,L]
# CATEGORIES
RewriteRule ^forum/cat([0-9]+)\.html$ /forum/index.php?c=$1 [QSA,L]
# PAGINATED FORUM
RewriteRule ^forum/forum([0-9]+)-([0-9]+)\.html$ /viewforum.php?f=$1&start=$2 [QSA,L]
# FORUM
RewriteRule ^forum/forum([0-9]+)\.html$ /forum/viewforum.php?f=$1 [QSA,L]
# PAGINATED TOPIC
RewriteRule ^forum/topic([0-9]+)-([0-9]+)\.html$ /forum/viewtopic.php?t=$1&start=$2 [QSA,L]
# TOPIC
RewriteRule ^forum/topic([0-9]+)\.html$ /forum/viewtopic.php?t=$1 [QSA,L]
# POST
RewriteRule ^forum/post([0-9]+)\.html$ /forum/viewtopic.php?p=$1 [QSA,L]
#PROFILES
RewriteRule ^forum/member([0-9]+)\.html$ /forum/profile.php?mode=viewprofile&u=$1 [QSA,L]
# END PHPBB PAGES
##################################################### |
and i have these problem , error 404 |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 13354
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 13354
|
|
| Back to top |
|
 |
|
|