Go Back   CodingForums.com > :: Server side development > Apache configuration

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-19-2013, 08:26 PM   PM User | #1
jeddi
Senior Coder

 
Join Date: May 2006
Posts: 1,513
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
Old 01-31-2013, 12:43 PM   PM User | #2
jeddi
Senior Coder

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



.
__________________
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
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:36 PM.


Advertisement
Log in to turn off these ads.