Jump to content

Having trouble with subdomain..


cgm225

Recommended Posts

I have a subdomain site that pulls pages based on an ID variable as such::

 

wedding.domain.com/index.php5?id=somevalue

 

I want the following to be the rewrites, but I cannot seem to get them to work on the subdomain..

 

RewriteRule ^home$ /index.php5

RewriteRule ^home/$ /index.php5

RewriteRule ^home/([^/\.]+)$ /index.php5?id=$1

RewriteRule ^home/([^/\.]+)/$ /index.php5?id=$1

 

Could someone help me with this?

 

Thank you all in advance!

 

bt

 

 

Link to comment
https://forums.phpfreaks.com/topic/88762-having-trouble-with-subdomain/
Share on other sites

You've given an example URI but not specified what it's supposed to do. We can't deduce that from your code if you've already said the code doesn't work and doesn't do what it is "supposed" to. If you can supply your intended transformation someone may be able to supply the correct rewrite rule.

 

The only general observations I'd make on the rule code is that the 4 cases could probably be simplified to 2 as far as I can see

Also your paths will probably have "/" prepended onto them at some point during rewrite cycles by Apache anyway which will nullify your conditions in ways you didn't anticipate ("home" will become "/home" if in root)

Did you intend to append what looks like the path segment after /home/ to the id= part? (I think I read the regex right)

You have no "last" flags [L]

 

Enable logging, use tail -f to monitor a test rewrite in real time and you should be able to see what is going wrong.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.