Rewrite

Discussion forum for MOD Writers regarding MOD Development.
ultimateguy
Registered User
Posts: 48
Joined: Tue Mar 26, 2013 11:53 pm

Rewrite

Post by ultimateguy » Fri May 31, 2013 10:34 pm

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

User avatar
Lumpy Burgertushie
Registered User
Posts: 66849
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Rewrite

Post by Lumpy Burgertushie » Fri May 31, 2013 10:39 pm

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
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51876
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Rewrite

Post by Brf » Fri May 31, 2013 10:41 pm

What "difference" are you expecting?
What URLs are you typing into your webbrower to be rewritten?

User avatar
Lumpy Burgertushie
Registered User
Posts: 66849
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Rewrite

Post by Lumpy Burgertushie » Fri May 31, 2013 10:48 pm

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
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

User avatar
5hocK
Registered User
Posts: 3011
Joined: Wed Nov 23, 2011 7:00 pm
Location: England

Re: Rewrite

Post by 5hocK » Fri May 31, 2013 10:52 pm

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 ;)
A thread is pretty much a topic. Stop with the pedantics will ya.

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51876
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Rewrite

Post by Brf » Fri May 31, 2013 10:54 pm

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

User avatar
Lumpy Burgertushie
Registered User
Posts: 66849
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Rewrite

Post by Lumpy Burgertushie » Fri May 31, 2013 11:14 pm

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
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.2 Styles by PlanetStyles.net

If a tree falls in the forest and nobody is there, does it make a sound?

ultimateguy
Registered User
Posts: 48
Joined: Tue Mar 26, 2013 11:53 pm

Re: Rewrite

Post by ultimateguy » Fri May 31, 2013 11:55 pm

Just want to make it work for phpBB 3 :lol:

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51876
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Rewrite

Post by Brf » Fri May 31, 2013 11:59 pm

As we already explained, it will not "work" unless you plan on typing those incorrect URLs into yor webbrowser.

The member1234.html part...

ultimateguy
Registered User
Posts: 48
Joined: Tue Mar 26, 2013 11:53 pm

Re: Rewrite

Post by ultimateguy » Sat Jun 01, 2013 12:19 am

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

User avatar
Brf
Support Team Member
Support Team Member
Posts: 51876
Joined: Tue May 10, 2005 7:47 pm
Location: {postrow.POSTER_FROM}
Contact:

Re: Rewrite

Post by Brf » Sat Jun 01, 2013 12:24 am

Did you type member1234.html into your webbrower's addressbar?

pbrouwers
Registered User
Posts: 58
Joined: Wed Nov 11, 2009 11:07 am

Re: Rewrite

Post by pbrouwers » Sat Jun 01, 2013 12:42 am

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.

ultimateguy
Registered User
Posts: 48
Joined: Tue Mar 26, 2013 11:53 pm

Re: Rewrite

Post by ultimateguy » Sat Jun 01, 2013 1:01 am

Thanks :) Can you please change the complete to working code and share it here? Please thank You :)

Yes, Just like that :D

pbrouwers
Registered User
Posts: 58
Joined: Wed Nov 11, 2009 11:07 am

Re: Rewrite

Post by pbrouwers » Sat Jun 01, 2013 1:22 am

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

ultimateguy
Registered User
Posts: 48
Joined: Tue Mar 26, 2013 11:53 pm

Re: Rewrite

Post by ultimateguy » Sat Jun 01, 2013 1:33 am

:o Anyway to use rewritten urls?

Locked

Return to “[3.0.x] MOD Writers Discussion”