URL Rewrite QueryString Params
5 posts
• Page 1 of 1
URL Rewrite QueryString Params
Hi
I'm new to this and was looking for a push in the right direction.
I have this url - PreviewGames/seo-template.aspx?type=blackjack&game=pontoon&gid=0&mid=0
Which I would like to be re-written as - PreviewGames/blackjack/pontoon/ can someone help please?
So if somebody were to use the link - PreviewGames/seo-template.aspx?type=blackjack&game=pontoon&gid=0&mid=0 they would actually see this url - PreviewGames/blackjack/pontoon/
Also, is there a way to replace %20 with _ ?
Thanks
M
I'm new to this and was looking for a push in the right direction.
I have this url - PreviewGames/seo-template.aspx?type=blackjack&game=pontoon&gid=0&mid=0
Which I would like to be re-written as - PreviewGames/blackjack/pontoon/ can someone help please?
So if somebody were to use the link - PreviewGames/seo-template.aspx?type=blackjack&game=pontoon&gid=0&mid=0 they would actually see this url - PreviewGames/blackjack/pontoon/
Also, is there a way to replace %20 with _ ?
Thanks
M
- HeliconAndrew
- Posts: 1264
- Joined: 07 Mar 2012, 10:16
Re: URL Rewrite QueryString Params
Hello,
Do you actually mena that you want to REDIRECT PreviewGames/seo-template.aspx?ty...id=0 --> to --> PreviewGames/blackjack/pontoon/ and actually display the content of PreviewGames/seo-template.aspx?typ...d=0?
Regards
Andrew
Do you actually mena that you want to REDIRECT PreviewGames/seo-template.aspx?ty...id=0 --> to --> PreviewGames/blackjack/pontoon/ and actually display the content of PreviewGames/seo-template.aspx?typ...d=0?
Regards
Andrew
Re: URL Rewrite QueryString Params
Hi
Yes that's right. I require a dynamic solution as I have hundreds of urls. Basically
PreviewGames/seo-template.aspx?type=[GAME_TYPE]&game=[GAME_NAME]&gid=0&mid=0 would get redirected to - PreviewGames/[GAME_TYPE]/[GAME_NAME]/
Thanks
M
Yes that's right. I require a dynamic solution as I have hundreds of urls. Basically
PreviewGames/seo-template.aspx?type=[GAME_TYPE]&game=[GAME_NAME]&gid=0&mid=0 would get redirected to - PreviewGames/[GAME_TYPE]/[GAME_NAME]/
Thanks
M
Re: URL Rewrite QueryString Params
At the moment I have this code working;
<Directory ~ "F:/Websites/.*/">
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ seo-template.aspx/%{REQUEST_URI} [QSA,L]
</Directory>
If I land on the page having followed PreviewGames/Blackjack/Pontoon/ then i get to see what is on - PreviewGames/seo-template.aspx?type=blackjack&game=pontoon&gid=0&mid=0
However if I follow the link - PreviewGames/seo-template.aspx?type=blackjack&game=pontoon&gid=0&mid=0
it does not redirect.
<Directory ~ "F:/Websites/.*/">
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ seo-template.aspx/%{REQUEST_URI} [QSA,L]
</Directory>
If I land on the page having followed PreviewGames/Blackjack/Pontoon/ then i get to see what is on - PreviewGames/seo-template.aspx?type=blackjack&game=pontoon&gid=0&mid=0
However if I follow the link - PreviewGames/seo-template.aspx?type=blackjack&game=pontoon&gid=0&mid=0
it does not redirect.
Re: URL Rewrite QueryString Params
Hi - I have solved my problem.
My solution is as follows;
RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} ^gametype=([^&]+)&gamename=([^&]+)$
RewriteRule ^(.*)$ %1/%2/? [NC,R=301,L]
Thanks
My solution is as follows;
RewriteEngine on
RewriteBase /
RewriteCond %{QUERY_STRING} ^gametype=([^&]+)&gamename=([^&]+)$
RewriteRule ^(.*)$ %1/%2/? [NC,R=301,L]
Thanks
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 16 guests