PHP - Cleanest Way To Have Wildcard Subdomain Mirror A Domain
My service allows users to generate subdomains based off their username(testguy.mydomain.com). I've created a wildcard subdomain for this, so the dynamic subdomains work wonderfully.
I've added a parked domain where my domain is supposed to mirror the given subdomain. However, when I go to the domain.com, it redirects to the subdomain, changing the URL in the address bar. Any ideas?
Or if there a better way to mirror a subdomain while showing the original domain in the address bar?
Edited by fitguydan, 12 June 2014 - 11:57 PM. Similar TutorialsHi,
I have an address on my main server http://www.website.com/directory and would like to redirect it to a subdomain http://subdomain.website.com/directory
The subdomain is not pointing to the same server as the main domain.
How would I set up a redirect in htaccess?
Thanks!
I tried many ways but unable to pass sessions to virtual subdomains on my site.. I edited ihi.ini file and included Code: [Select] session.cookie_domain = .mydomain.com I like to add that session is active on my main domain for www.mydomain.com only.. So how do I pass sessions for WWW to other subdomains ? Thanks n Advance hey all, I've been struggling with this for the last few days and can't figure it out... I'm trying to build a fairly complex uploading system. the thing i'm getting stuck with is trying to copy/move the uploaded files from the domain name to a subdomain Ex: $path1 = "/var/www/vhosts/domain.com/httpdocs/new/test/test.jpg"; $path2 = "/var/www/vhosts/domain.com/subdomains/img/httpdocs/test/test.jpg"; Dedicated server running RHEL with Plesk The problem seems to be an open_basedir restriction. My question is... are there any work-arounds open_basedir and if not what are the implications of disabling it??? Any help is greatly appreciated. Thank you for your time c Hi all, Im trying to move files that im uploading from my main domain to a sub domain. I think I can achieve this using passthru? Im having issues with this, can any one point me in the right direction please? Thanks, Phil I'm making an admin so I need to be able to do this: https://admin.mysite.com Run an upload image script from a file, saves image to folder in http://www.mysite.com Image Folder This topic has been moved to the corner of 3rd Avenue and mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=359430.0 I have two domains both running SSL. Let's call them old-domain and new-domain. old-domain is permanently redirecting traffic to new-domain. There are still a lot of links out there to old-domain with https://. If I were to remove SSL from old-domain but keep SSL on new-domain, I am betting that users will be getting some sort of certificate error. Right? Any way around that if I want to remove SSL from old-domain?
Hello, I am using this PHP script which needs to open several different files with similar names and extensions. This means: fopen(file_1.txt); However, I have about 300 of those files which I need to open and I don't want to rename them one by one. PERL had this awesome feature where you could create a variable with an asterix (wildcard) which would then find anything matching, using a wildcard. Something like: fopen(file_*.txt); ^Would open all files which had file_SOMETHING.txt in them. So is there anything like this in PHP? thanks in advance! <?php $title="juni/ngats.co.nr/hehe"; if ($title==([^/\.]+)/ngats.([^/\.]+).nr/([^/\.]+)) { echo it works; } whats wrong here? is it the wildcard? what do i need to do? it says it has errors with [... and then if i remove [] it will point out an error on ^ I would like some advice from someone who already has the quick answer. User uses a form (drop down) to define a variable in their search of the db. PHP/MYSQL Choices are ALL, A, B, C. EXAMPLE1 They choose B. $variable = 'B' SELECT .... WHERE.... x table value = $variable (equals B) All works perfectly. EXAMPLE2 Now if they chose ALL (or don't chose), I have a problem. They choose nothing (which should be ALL records). I need it to go back to having no WHERE portion of the sql command, or a WHERE that pulls all records. They choose nothing. $ variable = 'ALL' SELECT ... WHERE... x table value = $variable (which now equals ALL) I thought % was a wildcard but doesn't work. This seems simple... but eludes me. What should I use for a variable value if there is NO selection or ALL selection???? The WHERE x table value = has to equal SOMETHING, right? Should I be using an IF THEN to zap the line if it equals "all"? Any advice would be helpful! Thanks! What is the easiest way to get the value of subdomain. For example, when browsing word1.example.com; how to get it (like $_GET['q']) to put "word1" into an string. I started http://forums.phpfre...h-common-names/ a while back, and basically heard that I should use separate domains if I wish to ensure that cookies cannot be manipulated between one another. For instance, each of the following three URLs will have their own cookies which cannot be accessed from the others.
joe.user-sites.example.com/index.php
joe.site-admin.example.com/index.php
main-site.example.com/index.php
Problem is I don't wish to force the user to use these long URLs. Instead, I wish the user to see:
joe.example.com/index.php
admin.joe.example.com/index.php (or joe.example.com/admin/index.php if it is easier to make secure)
example.com/index.php
How is this accomplished? Thank you
Hello. I am currently working on a new site (http://sa.cx) that is basically a free domain like this: (example.sa.cx). My main goal is to allow users to set the the full MX, CNAME, A and SOA records. Any ideas on how I could go about this using php? My initial thought would be via cURL. my site is laid out as follows: beta.domain.com/index.html <-- this page contains an ajax form scripts.domain.com/js/formoperations.js <--ajax javascript scripts.domain.com/php/msgsend.php <--ajax php script The PHP script which is posted below is to echo back "Thank you" once the form is processed & emailed. If the files are in the directories stated above the PHP script does not echo back. It still completes emailing the form data successfully but does the echo does not make it back to beta.domain/index.html. HOWEVER...if I move my PHP file to beta.domain.com/msgsend.php it works flawlessly. Why can't my script echo across subdomains? Thanks! Code: [Select] <?php $fname= urldecode($_GET['param']); $lname = urldecode($_GET['param1']); $email = urldecode($_GET['param2']); $details = urldecode($_GET['param3']); $datereported = date(n."/".j."/".Y." @ ".g.":".i." ".A); $text="<p><b>First Name:</b> ".$fname."</p><p><b>Last Name:</b> ".$lname."</p><p><b>Email Address:</b> ".$email."</p><p><b>Message:</b> ".$details."</p>-End Submission"; $plaintext="First Name: ".$fname."\nLast Name: ".$lname."\nEmail Address: ".$email."\nMessage: ".$details."\n\n End Submission"; $to = 'chris@domain.com'; $subject = 'Web Message'; $random_hash = md5(date('r', time())); $headers = "From: Web Message\r\nReply-To: info@domain.com"; $headers .= "\r\nContent-Type: text/html; charset='iso-8859-1' Content-Transfer-Encoding: 7bit"; ob_start(); ?> <img src="http://uniformimgs.domain.com/emailheadcontact.gif" alt="" /> <p style="font-family:Arial, Helvetica, sans-serif; font-size:12px; margin:15px 0 50px 0;"><?php echo $fname.' '.$lname; ?> has submitted a message from the website on <?php echo $datereported; ?>.</p> <?php echo $text; ?> <? $message = ob_get_clean(); if(mail($to, $subject, $message, $headers)) { echo '<h4>Thanks for your message '.$fname.'!</h4><br/><br/><br/><br/>'; $to = $email; $subject = 'Thanks for your message!'; $random_hash = md5(date('r', time())); $headers = "From: info@domain.com\r\nReply-To: info@domain.com"; $headers .= "\r\nContent-Type: text/html; charset='iso-8859-1' Content-Transfer-Encoding: 7bit"; ob_start(); ?> <img src="http://uniformimgs.domain.com/emailheadcontact.gif" alt="" /> <p style="font-family:Arial, Helvetica, sans-serif; font-size:12px; margin:15px 0 5px 0;">Dear <?PHP echo $fname ?>,</p> <p style="font-family:Arial, Helvetica, sans-serif; font-size:12px; margin:0;">Thank you for sending us a message from our website; we love hearing from you folks! If needed, we'll contact you as soon as possible in regards to your message.</p> <p style="font-family:Arial, Helvetica, sans-serif; font-size:12px; margin:20px 0 0 200px;">Sincerely,</p> <p style="margin: 10px 0 0 200px;"><img src="http://uniformimgs.domain.com/briansig.gif" alt="" /></p> <p style="font-family:Arial, Helvetica, sans-serif; font-size:10px; margin:0px 0 0 200px;">John R Smith, pricipal</p> <p style="font-family:Arial, Helvetica, sans-serif; font-size:10px; margin:200px 0 0 0">This email has been sent by an automated service</p> <? $message = ob_get_clean(); //send the email mail($to, $subject, $message, $headers); } else { echo "<h5>Oops! Seems like we have a problem.</h5><h6>Please try again later or call XXX-XX-XXX.</h6>"; } ?> I did a project for a client over a year ago and never ran into this problem on their shared server, but now I'm having this problem on my own... and I'm not sure why.
I want to give free members their own subdomain. I want the php files to scan the subdomain to determine which pages to display. So like my index.php would scan the subdomain and show the corresponding user's home page so that if you go to someguy.thisdomain.com, it would really just scan index.php at thisdomain.com and act accordingly.
On the other project, no extra folders were created. I know that subdomains can be created in cpanel and then extra folders would be added and whatnot, but I was able to effectively use subdomains for users without htaccess or any sort of cpanel functions.
The main problem is when I test subdomains. I have php code that just echos "Subdomain is blah" and it works when I go to www.mydomain.com and also just mydomain.com, but when I go to test.mydomain.com, it gives an error as if the domain doesn't exist.
Hello guys i have been trying to find an alternative file function to read multiple files into an array. My aim is to preg_replace every file in directory starting with Audit_Report with the font colours...i have been googling it for like 2 hours and the closest answer i can get to is using the glob() function but it doesn't work for me still. I would like you guys to give me suggestions if you can..thanks!! <?php $file = "Audit_Report.(SEAN).(192.168.199.129).txt"; $lines = file($file); foreach ($lines as $line) { $string = $line; $patterns = array(); $patterns[0] = '/\bPass\b/'; $patterns[1] = '/\bFail\b/'; $patterns[2]='/\b============ Major Audit and Account Policies============ \b/'; $replacements = array(); $replacements[1] = "<font color=red>Fail</font>"; $replacements[0] = "<font color=green>Pass</font>"; $replacements[2] = "<br><b>==== Major Audit and Account Policies====</b>"; ksort($patterns); ksort($replacements); $a = preg_replace($patterns, $replacements, $string); echo "$a<br />\n"; file_put_contents(basename($file, substr($file, strpos($file, '.'))) . ".html","$a<br />\n", FILE_APPEND) or die("Cannot write file"); } ?> This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=313168.0 Suppose, i have created a sub.domain.com and i want to include a file 'config.php' from root directory i.e domain.com . While i tried include("../config.php"); i wasn't successful. Anyone can help me please?? I need the solution very urgently, so please help me soon. pracasify@yahoo.com facebook.com/agptj I was wondering of it was possible to have a file say style.css in the root folder of a site like www.example.com/style.css and then get a subdomain called www.sub.example.com which points to www.example.com/subarea to get that file without the use of absolute paths? Sorry if its not clear. |