Welcome to HBH! If you have tried to register and didn't get a verification email, please using the following link to resend the verification email.

mod rewrite Perfection


ghost's Avatar
0 0

Hi all,

I was wondering if anyone could help me with the following:

markupRewriteRule ^index.php?l=([0-9].*)&s=([0-9]+)&mod=([a-zA-Z]+)&view=([a-zA-Z]+)&no=([0-9]+) /index/league/$1/season/$2/mod/$3/view/$4/num/$5

I want it to replace markupl=2&s=2&mod=user&view=admin&no=1 to something like: markup/league/1/season/2/mod/user/view/admin/num/1

Any reason why this wouldn't work?

~RichieC


SySTeM's Avatar
-=[TheOutlaw]=-
20 0

RewriteEngine On

RewriteRule ^index\/league\/([0-9]+)\/season\/([0-9]+)\/mod\/([a-zA-Z]+)\/view\/([a-zA-Z]+)\/num\/([0-9]+)$ index\.php\?l=$1&s=$2&mod=$3&view=$4&no=$5


ghost's Avatar
0 0

Cheers system_meltdown, but it still doesn't appear to be working. Have you got any idea why that would be?

It still appears to show the query strings.


SySTeM's Avatar
-=[TheOutlaw]=-
20 0

DarkMantis wrote: Cheers system_meltdown, but it still doesn't appear to be working. Have you got any idea why that would be?

It still appears to show the query strings.

Shows the query strings? How do you mean?


ghost's Avatar
0 0

Well It appears that the URL has not been rewritten at all.

Here is the result of the rewrite after applied:

markupindex.php?l=2&s=3&mod=user&view=admins

And here is the .htaccess file as of now:

RewriteBase / RewriteEngine On RewriteRule ^index\/league\/([0-9]+)\/season\/([0-9]+)\/mod\/([a-zA-Z]+)\/view\/([a-zA-Z]+)\/num\/([0-9]+)$ index\.php\?l=$1&s=$2&mod=$3&view=$4&no=$5


SySTeM's Avatar
-=[TheOutlaw]=-
20 0

Lol… that's not how it works dude. It simply creates a symlink to it, of course you can still access it the main way, but if you try and go to the rewritten url directly via the address bar it should work.


ghost's Avatar
0 0

Ahh right, sorry I obviously got it wrong, So if I rewrite the links literally then it will go directly to the same place?

Sorry, I'm quite new to mod_rewrite and regex.

Thanks.


SySTeM's Avatar
-=[TheOutlaw]=-
20 0

DarkMantis wrote: So if I rewrite the links literally then it will go directly to the same place?

Should do, yeah :)


ghost's Avatar
0 0

What did you expected.. lol


clone4's Avatar
Perl-6 Wisdom Seeker
0 0

l337 wrote: What did you expected.. lol

And the award for the most useless post of the month goes to……. drum roll

Oh my god, how unexpected, it is L336!!! applause

…lol