vBulletin Mods

The Official vBulletin Modifications Site
https://www.vbulletin.org/forum/showthread.php?t=320330

Help with couple of mod_redirect rules
by Jaffery
23 Sep 2015 15:34

Since, I just got rid of vbseo, now I am trying to deal with redirect as much as possible. Taking care of threads was easy however still urls like tags, attachments etc. remains.. so, I hope guys here may help me through with their wisdom in mod_rewrite rules .. regex

So, I am stuck on this.. wants to do following:

redirect:
domain.com/talk/tags/letter.html (letter is tag)

To

domain.com/talk/tags.php?tag=letter


I tried this


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

But its not working.

My forum is at :
domain.com/talk

And I am adding above rule in domain.com/talk/.htaccess with "RewriteBase /talk/" .
This is where I have added thread redirection code which works fine.

Dave 23 Sep 2015 17:23

Hmm it should work fine..
What if you remove the slash before tags.php in your rewrite rule?

Jaffery 23 Sep 2015 20:37

Quote:

Originally Posted by Dave (Post 2555608)
Hmm it should work fine..
What if you remove the slash before tags.php in your rewrite rule?

Nope its not working, and if I remove / from tags.php , it will add absolute path to the file.. but here first thing is that it should detect the rule at first place.

kh99 23 Sep 2015 20:59

Maybe you want [^.], like

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


ETA: Hmm...or in case tags can show up elsewhere in the path, maybe both . and /, like

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Dave 23 Sep 2015 21:04

Could it be that an other rewrite rule is being applied before it reaches that one? Can you post all the contents of your .htaccess file?

Jaffery 23 Sep 2015 23:30

Quote:

Originally Posted by kh99 (Post 2555618)
Maybe you want [^.], like

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


ETA: Hmm...or in case tags can show up elsewhere in the path, maybe both . and /, like

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Thanks guys, it worked with following: (and yes there were some conflicting rules from default vb)



Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Now I need to handle attachment urls :

Its like :

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Here 2451 is image ID:

I did this :


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Again not working..

No matter how much I read about regex, its always confusing for me, can you guys confirm if I read it correct :

[^/] mean any character except /
so,
[^./] means any character exept . and /

am I reading it right ?

--------------- Added 23 Sep 2015 at 23:36 ---------------

Well.. I donno but now its working .. for precaution I have added condition for attachment url redirect:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Is it as I think, ie. first checking condition if URI contains /albums/ word and then only proceed for further match and redirect ?

Brandon Sheley 23 Sep 2015 23:49

I know Joe @BirdOfPrey... oh ya,, vb doesn't do that :(

Well anyways, he helped me out tremendously with some redirects.
Maybe He'll see this thread and post.


All times are GMT. The time now is 10:16.

Powered by vBulletin® Version 3.8.14
Copyright © 2021, MH Sub I, LLC dba vBulletin. All Rights Reserved. vBulletin® is a registered trademark of MH Sub I, LLC
Copyright ©2001 - , vbulletin.org. All rights reserved.