View Single Post
Old 01-19-2013, 08:26 PM   PM User | #1
jeddi
Senior Coder

 
Join Date: May 2006
Posts: 1,512
Thanks: 26
Thanked 4 Times in 4 Posts
jeddi has a little shameless behaviour in the past
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.



.
__________________
If you want to attract and keep more clients, then offer great customer support.

Support-Focus.com. automates the process and gives you a trust seal to place on your website.
I recommend that you at least take the 30 day free trial.
jeddi is offline   Reply With Quote