PDA

View Full Version : mod rewrite vb4 to vb5


Joe2288
04-06-2018, 03:17 AM
I just upgraded to vb5 from 4.2.5
In 4.2.5 I was using the option for SEO friendly url's via .htaccess mod rewrite that comes standard (option 4) with that version.

URL's for threads look like https://mysite.com/threads/427-This-is-a-thread

this is what I have in my .htaccess

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

# Forum
RewriteRule ^threads/.* showthread.php [QSA]
RewriteRule ^forums/.* forumdisplay.php [QSA]
RewriteRule ^members/.* member.php [QSA]
RewriteRule ^blogs/.* blog.php [QSA]
RewriteRule ^entries/.* entry.php [QSA]

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]

# MVC
RewriteRule ^(?:(.*?)(?:/|$))(.*|$)$ $1.php?r=$2 [QSA]

# Check MVC result
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.*)$ - [NC,L]
RewriteRule ^(.*)$ - [R=404,L]


I have 100s of links indexed by google in that format. Unfortunately this is not compatible with vb5 but my understanding is that vb5 would be able to process the "standard" format e.g. https://mysite.com/showthread.php?t=427
and forward that to the correct threads.

So the idea is to do the reverse of above code , basically rewriting the google indexed links
https://mysite.com/threads/427-This-is-a-thread back into the normal vb4 format
https://mysite.com/showthread.php?t=427 which will be understood by vb5 hence the google indexed links would go to the correct pages.

Does this make any sense and if so can anybody help me with that code?