# Mod Rewrite Help

**URL:** <https://forum.kirupa.com/t/mod-rewrite-help/324694>\
**Category:** programming\
**Created:** [September 3, 2011, 6:16pm UTC](https://forum.kirupa.com/t/mod-rewrite-help/324694 "2011-09-03T18:16:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![0x66FF00](https://avatars.discourse-cdn.com/v4/letter/0/dbc845/32.png) [@0x66FF00](https://forum.kirupa.com/u/0x66FF00)\
**Post date:** [September 3, 2011, 6:16pm UTC](https://forum.kirupa.com/t/mod-rewrite-help/324694/1 "2011-09-03T18:16:14Z")

</div>

Hello,

I really tried to Google it, but failed (miserably). I want to do two things and can’t seem to combine them… I want to use urls like this:  
[COLOR=#B22222]  
sub[/COLOR].domain.com/[COLOR=#0000CD]value  
[/COLOR]  
First thing would be to redirect everything wrong subdomain to the right one:  
[COLOR=#0000CD][COLOR=#B22222]  
[whatever][/COLOR][/COLOR].domain.com -\> [COLOR=#0000CD][COLOR=#B22222]sub[/COLOR][/COLOR].domain.com

Next I’ll have to pass the value to a php file.

[sub.domain.com/[COLOR=#0000cd]value[/COLOR]](http://sub.domain.com/%5BCOLOR=#0000cd%5Dvalue%5B/COLOR%5D) -\> [sub.domain.com/index.php?var=[COLOR=#0000CD][COLOR=#0000CD]value[/COLOR]](http://sub.domain.com/index.php?var=%5BCOLOR=#0000CD%5D%5BCOLOR=#0000CD%5Dvalue%5B/COLOR%5D) [/COLOR]

All I find is tutorials for the value, but the subdomain part is equally crucial in my case and I can’t seem to get both working at the same time ☹ It either redirects or passes the variable. Does anyone know how to do this? That would be super helpful!!
