Jump to content

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.