...

View Full Version : Problems with my mod rewrite



jeddi
11-16-2012, 01:53 PM
Hi,

I am trying to make my user to redirect when they go to a certain directory.

Eg when the url is :
http://simpg.net/info/learnturkish
or
http://www.simpg.net/info/learnturkish

The redirection should go to :
http://simpg.net/info.php?a=learnturkish

If have tried the following.


RewriteCond %{HTTP_HOST} simpg.net [NC]
RewriteCond %{REQUEST_URI} ^/info/ [NC]
RewriteRule ^(.*)$ http://simpg.net/info.php?a=%1 [NC,QSA,L]


But it is not working.

It seems that the "learnturkish" is not getting passed.

What have I done wrong ?

Thanks.

Arcticwarrio
11-16-2012, 05:04 PM
this is the rule i have:




Options +FollowSymLinks
RewriteEngine on

RewriteRule index(.*)\.htm$ index.php
RewriteRule (.*)_Home\.htm$ index.php

jeddi
12-11-2012, 07:53 PM
Hi,

I have tried another 2 options

but I can not seem to get this working :(


I would like :

1.mbpg.net

and


mbpg.net/coupons/1

to get redirected to :

http://mbpg.net/coupon.php?a=1

So I have tried these.


RewriteCond %{HTTP_HOST} ^([^.]+).mbpg.net [NC]
RewriteCond %{HTTP_HOST} !=www.mbpg.net [NC]
RewriteRule ^.*$ http://mbpg.net/coupon.php?a=%1 [NC,QSA,L]

RewriteCond %{HTTP_HOST} mbpg.net/coupons/^([^.]+) [NC]
RewriteRule ^.*$ http://mbpg.net/coupon.php?a=%1 [NC,QSA,L]

Can anyone help ?

Thanks.


.

Fou-Lu
12-11-2012, 08:11 PM
Not sure why this is in the PHP section since it has nothing to do with PHP. Moving to apache configurations.

Can you get any mod_rewrite to work? Use this for your rewrite engine to verify:


RewriteEngine On
RewriteRule ^/coupons/([^.]+)$ coupon.php?a=$1 [NC,QSA,L]

jeddi
12-12-2012, 10:10 AM
Hi,

Thanks for helping out.

I tried what you suggested.

Here is my .htaccess file:


Options +FollowSymLinks
RewriteEngine On

# BELOW IS STUFF TO BLOCK SPAMMING ATTACKS
######################################################
# Block out any script trying to set a mosConfig value through the URL
RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|%3D) [OR]

# Block out any script trying to base64_encode crap to send via URL
RewriteCond %{QUERY_STRING} base64_encode.*(.*) [OR]

# Block out any script that includes a <script> tag in URL
RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR]

# Block out any script trying to set a PHP GLOBALS variable via URL
RewriteCond %{QUERY_STRING} GLOBALS(=|[|%[0-9A-Z]{0,2}) [OR]

# Block out any script trying to modify a _REQUEST variable via URL
RewriteCond %{QUERY_STRING} _REQUEST(=|[|%[0-9A-Z]{0,2})

# Send all blocked request to homepage with 403 Forbidden error!
RewriteRule ^(.*)$ index.php [NC,L]
#
######################################################

RewriteRule ^/coupons/([^.]+)$ coupon.php?a=$1 [NC,QSA,L]


But when I enter this:
http://www.mbpg.net/coupons/1


Not Found

The requested URL /coupons/1 was not found on this server.

But when I enter this:
http://www.mbpg.net/coupon.php?a=1

I get my test page come up.

So looks like this redirect isn't working.

Redirects on other sites on this server are working OK

There must be something I have done wrong ??



.

Fou-Lu
12-12-2012, 02:03 PM
How did I end up with not all chars.
Try with *only* this: RewriteRule coupons/(.+)$ coupon.php?a=$1 [NC,QSA,L] and the rewrite engine enabling. If that still doesn't work with coupons/x, then you cannot use rewrite.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum