Page 1 of 2

Rewrite

Posted: Fri May 31, 2013 10:34 pm
by ultimateguy
Hi,

I have got this codes

Code: Select all

RewriteEngine On
RewriteBase /
RewriteRule ^s/(.*).pl$ /cgi-bin/$1.php [L]
RewriteRule ^htaccess/.+/([^/]+.html)$ /htaccess/index.php [R=301,L]
RewriteRule ^htaccess/.+-vc([0-9]+).html$ /htaccess/index.php?c=$1 [QSA,L]
RewriteRule ^htaccess/.+-vf([0-9]+)-([0-9]+).html$ /htaccess/viewforum.php?f=$1&start=$2 [QSA,L]
RewriteRule ^htaccess/.+-vf([0-9]+).html$ /htaccess/viewforum.php?f=$1 [QSA,L]
RewriteRule ^htaccess/.+-vt([0-9]+)-([0-9]+).html$ /htaccess/viewtopic.php?t=$1&start=$2 [QSA,L]
RewriteRule ^htaccess/.+-vt([0-9]+).html$ /htaccess/viewtopic.php?t=$1 [QSA,L]
RewriteRule ^htaccess/post([0-9]+).html$ /htaccess/viewtopic.php?p=$1 [QSA,L]
RewriteRule ^htaccess/member([0-9]+).html$ /htaccess/profile.php?mode=viewprofile&u=$1 [QSA,L]
and I have placed them in .htaccess But I don't any difference :( I have the mod rewrite thing module installed on the server :?

EDIT:
From http://www.askapache.com/htaccess/last- ... phpbb.html

Re: Rewrite

Posted: Fri May 31, 2013 10:39 pm
by Lumpy Burgertushie
this has to do with mod-rewrite and probably phpbb-seo which is not the same files that you get from here.

also none of that is needed for good SEO with phpbb. the search engines find all of the phpbb pages just fine without changing the URLs/filenames at all.


robert

Re: Rewrite

Posted: Fri May 31, 2013 10:41 pm
by Brf
What "difference" are you expecting?
What URLs are you typing into your webbrower to be rewritten?

Re: Rewrite

Posted: Fri May 31, 2013 10:48 pm
by Lumpy Burgertushie
I just noticed that you have all of those files listed in a folder named htaccess. there is no folder named htaccess and there shouldn't be.


robert

Re: Rewrite

Posted: Fri May 31, 2013 10:52 pm
by 5hocK
ultimateguy wrote:I have got this codes................. http://www.askapache.com/htaccess/last- ... phpbb.html
That guide is from Nov 07, 2006, probably best to forget you ever found it. Also a good tip to try and solve one thing at a time ;)

Re: Rewrite

Posted: Fri May 31, 2013 10:54 pm
by Brf
I am betting the he is thinking the htaccess is going to change all of the URLs in his phpBB.
That is not what mod_rewrite does. What it does is take the URL typed in your webbrowser's addressbar and direct it to a different page. For instance, that code will direct a /htaccess/member1234.html to the address /htaccess/profile.php?mode=viewprofile&u=1234
Of course profile.php does not exist in phpBB3

Re: Rewrite

Posted: Fri May 31, 2013 11:14 pm
by Lumpy Burgertushie
and there is no folder named htaccess in phpbb and there shouldn't be one on your server.

htaccess is a file ( not a folder ) where you would put that mod rewrite stuff once you learn how to use it and what it is for.


robert

Re: Rewrite

Posted: Fri May 31, 2013 11:55 pm
by ultimateguy
Just want to make it work for phpBB 3 :lol:

Re: Rewrite

Posted: Fri May 31, 2013 11:59 pm
by Brf
As we already explained, it will not "work" unless you plan on typing those incorrect URLs into yor webbrowser.

The member1234.html part...

Re: Rewrite

Posted: Sat Jun 01, 2013 12:19 am
by ultimateguy
I changed to this code but still no difference :(

Code: Select all

RewriteEngine On
RewriteBase /
RewriteRule ^s/(.*).pl$ /cgi-bin/$1.php [L]
RewriteRule ^.+/([^/]+.html)$ /index.php [R=301,L]
RewriteRule ^.+-vc([0-9]+).html$ /index.php?c=$1 [QSA,L]
RewriteRule ^.+-vf([0-9]+)-([0-9]+).html$ /viewforum.php?f=$1&start=$2 [QSA,L]
RewriteRule ^.+-vf([0-9]+).html$ /viewforum.php?f=$1 [QSA,L]
RewriteRule ^.+-vt([0-9]+)-([0-9]+).html$ /viewtopic.php?t=$1&start=$2 [QSA,L]
RewriteRule ^.+-vt([0-9]+).html$ /viewtopic.php?t=$1 [QSA,L]
RewriteRule ^post([0-9]+).html$ /viewtopic.php?p=$1 [QSA,L]
RewriteRule ^member([0-9]+).html$ /memberlist.php?mode=viewprofile&u$1 [QSA,L]
I have my forum in sub folder like 127.0.0.1:8080/forum

Re: Rewrite

Posted: Sat Jun 01, 2013 12:24 am
by Brf
Did you type member1234.html into your webbrower's addressbar?

Re: Rewrite

Posted: Sat Jun 01, 2013 12:42 am
by pbrouwers
Remove the RewriteBase /
And the slash before /index.php, /memberlist.php, ..

In your rewrite url for the member you have a little mistake.

Code: Select all

RewriteRule ^member([0-9]+).html$ memberlist.php?mode=viewprofile&u=$1 [QSA,L]
You forgot the = between u and $1.

member2.html will work now. (With those changes it does for me)

I don't know exactly how you want to display the others? topicname-vt10.html ?

Edit: welcome-to-phpbb3-vt1.html & your-first-forum-vf2.html work.

Re: Rewrite

Posted: Sat Jun 01, 2013 1:01 am
by ultimateguy
Thanks :) Can you please change the complete to working code and share it here? Please thank You :)

Yes, Just like that :D

Re: Rewrite

Posted: Sat Jun 01, 2013 1:22 am
by pbrouwers
Rewrite:

Code: Select all

RewriteEngine On
RewriteRule ^.+-vc([0-9]+).html$ index.php?c=$1 [QSA,L]
RewriteRule ^.+-vf([0-9]+)-([0-9]+).html$ viewforum.php?f=$1&start=$2 [QSA,L]
RewriteRule ^.+-vf([0-9]+).html$ viewforum.php?f=$1 [QSA,L]
RewriteRule ^.+-vt([0-9]+)-([0-9]+).html$ viewtopic.php?t=$1&start=$2 [QSA,L]
RewriteRule ^.+-vt([0-9]+).html$ viewtopic.php?t=$1 [QSA,L]
RewriteRule ^post([0-9]+).html$ viewtopic.php?p=$1 [QSA,L]
RewriteRule ^member([0-9]+).html$ memberlist.php?mode=viewprofile&u=$1 [QSA,L]
Use:

Code: Select all

your-first-category-vc1.html
your-first-forum-vf2-2.html
your-first-forum-vf2.html
welcome-to-phpbb3-vt1-2.html
welcome-to-phpbb3-vt1.html
post1.html
member2.html
Note: these rewrite rules will only work when you enter them in the browser. (127.0.0.1:8080/forum/member2.html)

When you click on a topic link, it will just display the normal viewtopic.php

Re: Rewrite

Posted: Sat Jun 01, 2013 1:33 am
by ultimateguy
:o Anyway to use rewritten urls?