CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   Apache configuration (http://www.codingforums.com/forumdisplay.php?f=69)
-   -   Problem with my rewriteRule (http://www.codingforums.com/showthread.php?t=286091)

jeddi 01-19-2013 08:26 PM

Problem with my rewriteRule
 
Hi again,

I have another problem.

I get 2 kinds of links coming to my server.

This kind:

1)
villa-rent-siberia.example.com

Which OK as I have this to redirect it:

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

Now the other type is more complex - t looks like this:

2)
villa-rent-siberia.example.com/17-vacationsinsiberia.html

Actually it's not more complicated because it contains the record no. 17

But I need to process this type before the first (1) because otherwise it will generate the wrong page.

But I am not sure how to this.

I have tried this:

Code:

Options +SymLinksifOwnerMatch
RewriteEngine On

RewriteCond %{HTTP_HOST} ^(.+).example.com [NC]
RewriteCond %{HTTP_HOST} !=www.example.com [NC]
RewriteRule ^[\.0-9,-a-z]+\.example.com/([0-9]+)+[\.0-9,-a-z]+\.html$ http://example.com/info.php?a=%1 [NC,QSA,L]

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

Unfortunately that's not working for long url,
info.php doesn't run, only help.php and it returns the wrong page.

How can I get the info.php to run by extracting that no. 17 ?

thanks for any help.



.

jeddi 01-31-2013 12:43 PM

Wow - Over a thousand page views.


I have changed the rewrite rule to:

Code:

RewriteRule ^[\.0-9,-a-z]+\.example.com/([0-9]+)+-[\.0-9,-a-z]+\.html$ http://example.com/info.php?a=%1 [NC,QSA,L]
But ... I am still having a problem with it,

Any ideas what is wrong with it ?



.


All times are GMT +1. The time now is 06:42 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.