d.shankar Posted August 5, 2008 Share Posted August 5, 2008 Hi all Assume this is my site www.mysite.com subdomain forums.mysite.com In the forums.mysite.com i have placed a folder called "disc" and in that folder i have placed a php code test.php <?php echo $_GET['var']; ?> When i run this URL , forums.mysite.com/disc/test.php?var=hello It displays "hello" Now i need to rewrite the url using mod_rewrite. NOTE: mod_rewrite is enabled in my server this is my .htaccess file RewriteEngine On RewriteRule ^disc/([a-zA-Z]+)/?$ /test.php?var=$1 [L] I have uploaded this inside the disc folder , But when i run forums.mysite.com/disc/hello , I am getting 404 error. Can someone help me out ? Link to comment https://forums.phpfreaks.com/topic/118227-mod_rewrite-from-subdomain/ Share on other sites More sharing options...
JasonLewis Posted August 5, 2008 Share Posted August 5, 2008 Wrong section. But, try making this: /test.php?var=$1 Like this: disc/test.php?var=$1 Link to comment https://forums.phpfreaks.com/topic/118227-mod_rewrite-from-subdomain/#findComment-608437 Share on other sites More sharing options...
d.shankar Posted August 5, 2008 Author Share Posted August 5, 2008 No it didnt.. still 404 ! Link to comment https://forums.phpfreaks.com/topic/118227-mod_rewrite-from-subdomain/#findComment-608559 Share on other sites More sharing options...
Prodigal Son Posted August 5, 2008 Share Posted August 5, 2008 Did you try it wish a dash in front? "/disc/test.php?var=$1" Link to comment https://forums.phpfreaks.com/topic/118227-mod_rewrite-from-subdomain/#findComment-608583 Share on other sites More sharing options...
d.shankar Posted August 5, 2008 Author Share Posted August 5, 2008 No dude.. I think there is a problem with regex. I will chk out. Link to comment https://forums.phpfreaks.com/topic/118227-mod_rewrite-from-subdomain/#findComment-608585 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.