Custom pages URL rewrite

Discussions and support about the different URL Rewriting techniques for phpBB.

Moderator: Moderators

Custom pages URL rewrite

Postby Gisher » Tue Dec 23, 2008 7:14 am

For example, I've created custom page as explane here
http://www.phpbb.com/kb/article/add-a-n ... -to-phpbb/
Want rewrite aboutus.php to aboutus.html
How do this correctly?
(Try many ways with .htaccess, but not sure, that they are correct)
Gisher
PR0
PR0
 
Posts: 83
Joined: Sat Sep 27, 2008 8:54 am

Advertisement

Postby dcz » Tue Dec 23, 2008 9:05 am

With something like this (eg with proper path and slashes) in your .htaccess :
Code: Select all
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([a-z0-9_-]+)\.html$ $1.php [QSA,L,NC]


You'd be able to use aboutus.html for aboutus.php as well as anything.html as long as anything.php does exist.

If you are not using virtual folders for forums, then you'll have to specify each file to handle instead :
Code: Select all
RewriteRule ^(aboutus|anything)\.html$ $1.php [QSA,L,NC]


Then, you should just use the .html extension while building links to your added pages, (instead of .php).

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21382
Joined: Fri Apr 28, 2006 9:03 pm

Postby Gisher » Tue Dec 23, 2008 9:17 am

T U very much :)

I add
Code: Select all
RewriteEngine On
Rewritecond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule \.php$ /nonexistentfile
RewriteRule ^(icq|about)\.html$ $1.php [QSA,L,NC]
Gisher
PR0
PR0
 
Posts: 83
Joined: Sat Sep 27, 2008 8:54 am

Postby dcz » Tue Dec 23, 2008 10:07 am

You do not really need this part :
Code: Select all
Rewritecond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule \.php$ /nonexistentfile


++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21382
Joined: Fri Apr 28, 2006 9:03 pm

Postby Gisher » Tue Dec 23, 2008 10:23 pm

That part for custom error pages, if call missing php file on board (error 404)
Gisher
PR0
PR0
 
Posts: 83
Joined: Sat Sep 27, 2008 8:54 am

Re: Custom pages URL rewrite

Postby angelus » Sun Apr 05, 2009 3:43 pm

is it true ? my site is root ./

Code: Select all
RewriteRule ^about/rules\.html$ about/rules.php [QSA,L,NC]



thanks
angelus
PR0
PR0
 
Posts: 61
Joined: Sat Nov 10, 2007 4:36 pm

Re: Custom pages URL rewrite

Postby dcz » Tue Apr 07, 2009 7:48 am

Hard to tell, what should be true / false here ?

The rewriterule is syntactically correct, but I've no idea if it's working for what you want to do.
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21382
Joined: Fri Apr 28, 2006 9:03 pm


Return to phpBB mod Rewrite

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 12 guests