phpBB SEO
Boards
Directory  
SEO  
Downloads
  phpBB SEO : Search Engine Optimization, Directory, Forums  
Index
Forums
Annuaire
Référencement
Télécharger
 
  Search Rechercher
    Register
Username :  Password :  Log me on automatically each visit  
S'enregistrer  
 
   
.htaccess in a folder

 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB mod Rewrite  » Simple mod rewrite
::  
Author Message
C@



Joined: 25 Jan 2007
Posts: 5

.htaccess in a folderPosted: 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/ ?
Rolling Eyes
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 Smile
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

.htaccess in a folderPosted: Thu Jan 25, 2007 11:57 am    Post subject: Re: .htaccess in a folder

And welcome Very Happy

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
Visit poster's website
C@



Joined: 25 Jan 2007
Posts: 5

.htaccess in a folderPosted: Thu Jan 25, 2007 5:30 pm    Post subject: Re: .htaccess in a folder

Thank you for your prompt reply Smile



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 Sad 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 Sad

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 Sad

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
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

.htaccess in a folderPosted: Thu Jan 25, 2007 5:39 pm    Post subject: Re: .htaccess in a folder

You're welcome Wink

Well, you can post all your .htaccess file if not too long, we'll fix the eventual problems. It handier this way.

Or, try to change :

Code:
RewriteBase /


With :

Code:
RewriteBase /forum/


In the forum/'s one.

As well, make sure you're running only one set of rewrite rules fro the forum, not from both root and forum/ Wink

++

_________________
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
Visit poster's website
C@



Joined: 25 Jan 2007
Posts: 5

.htaccess in a folderPosted: Thu Jan 25, 2007 5:56 pm    Post subject: Re: .htaccess in a folder

Code:
RewriteBase /forum/
didn't make any difference Confused

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 Sad
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

.htaccess in a folderPosted: 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 Wink

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
Visit poster's website
C@



Joined: 25 Jan 2007
Posts: 5

.htaccess in a folderPosted: 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 Wink because your mod is intended to work only with phpBB
Back to top
C@



Joined: 25 Jan 2007
Posts: 5

.htaccess in a folderPosted: Thu Jan 25, 2007 6:51 pm    Post subject: Re: .htaccess in a folder

I fixed the problem myself Very Happy 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 Wink

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
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

.htaccess in a folderPosted: 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 Wink

_________________
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
Visit poster's website
Ľubor
PR0
PR0


Joined: 13 Feb 2007
Posts: 52
Location: Slovakia,Bratislava

.htaccess in a folderPosted: 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
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

.htaccess in a folderPosted: Tue Sep 04, 2007 8:51 am    Post subject: Re: .htaccess in a folder

It's pretty normal, have a look at the one two posts above : http://www.phpbb-seo.com/boards/simple-mod-rewrite/discussions-vt691.html#5511

++

_________________
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
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

.htaccess in a folderPosted: Wed Feb 06, 2008 9:37 pm    Post subject: Re: .htaccess in a folder

Topic splitted : http://www.phpbb-seo.com/boards/simple-mod-rewrite/discussions-vt2094.html

++

_________________
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
Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB mod Rewrite  » Simple mod rewrite
Page 1 of 1

Navigation Similar Topics

Jump to: