Jump to content

elchenuk

New Members
  • Posts

    8
  • Joined

  • Last visited

Everything posted by elchenuk

  1. Ok I have just done an echo of the URL and it is showing as the requested URL and not as the substituted URL. And of course it is the substituted URL that contains the variables that will be entered into the page copy.
  2. Not sure if this what you wanted but here is everything that is in the .htaccess file # Follow symbolic links in this directory. Options +FollowSymLinks # Make Drupal handle any 404 errors. ErrorDocument 404 /index.php # Force simple error message for requests for non-existent favicon.ico. <Files favicon.ico> # There is no end quote below, for compatibility with Apache 1.3. ErrorDocument 404 "The requested file favicon.ico was not found. </Files> # rewrite for the mdg transformation pages RewriteEngine on RewriteRule ^anothercompany$ mgd-trans-campaign/index.php?var=Another-Company [NC,L] RewriteRule ^birkdalehighschool$ mgd-trans-campaign/index.php?var=Birkdale-High-School # Set the default handler. DirectoryIndex index.php # Override PHP settings. More in sites/default/settings.php # but the following cannot be changed at runtime. # PHP 4, Apache 1. <IfModule mod_php4.c> php_value magic_quotes_gpc 0 php_value register_globals 0 php_value session.auto_start 0 php_value mbstring.http_input pass php_value mbstring.http_output pass php_value mbstring.encoding_translation 0 </IfModule> # PHP 4, Apache 2. <IfModule sapi_apache2.c> php_value magic_quotes_gpc 0 php_value register_globals 0 php_value session.auto_start 0 php_value mbstring.http_input pass php_value mbstring.http_output pass php_value mbstring.encoding_translation 0 </IfModule> # PHP 5, Apache 1 and 2. <IfModule mod_php5.c> php_value magic_quotes_gpc 0 php_value register_globals 0 php_value session.auto_start 0 php_value mbstring.http_input pass php_value mbstring.http_output pass php_value mbstring.encoding_translation 0 </IfModule> # Requires mod_expires to be enabled. <IfModule mod_expires.c> # Enable expirations. ExpiresActive On # Cache all files for 2 weeks after access (A). ExpiresDefault A1209600 <FilesMatch \.php$> # Do not allow PHP scripts to be cached unless they explicitly send cache # headers themselves. Otherwise all scripts would have to overwrite the # headers set by mod_expires if they want another caching behavior. This may # fail if an error occurs early in the bootstrap process, and it may cause # problems if a non-Drupal PHP file is installed in a subdirectory. ExpiresActive Off </FilesMatch> </IfModule> # Various rewrite rules. <IfModule mod_rewrite.c> RewriteEngine on # If your site can be accessed both with and without the 'www.' prefix, you # can use one of the following settings to redirect users to your preferred # URL, either WITH or WITHOUT the 'www.' prefix. Choose ONLY one option: # # To redirect all users to access the site WITH the 'www.' prefix, # (http://example.com/... will be redirected to http://www.example.com/...) # adapt and uncomment the following: RewriteCond %{HTTP_HOST} ^freedomcomms\.com$ [NC] RewriteRule ^(.*)$ http://www.freedomcomms.com/$1 [L,R=301] # # To redirect all users to access the site WITHOUT the 'www.' prefix, # (http://www.example.com/... will be redirected to http://example.com/...) # uncomment and adapt the following: # RewriteCond %{HTTP_HOST} ^www\.freedomcomms\.com$ [NC] # RewriteRule ^(.*)$ http://freedomcomms.com/$1 [L,R=301] # Modify the RewriteBase if you are using Drupal in a subdirectory or in a # VirtualDocumentRoot and the rewrite rules are not working properly. # For example if your site is at http://example.com/drupal uncomment and # modify the following line: # RewriteBase /drupal # # If your site is running in a VirtualDocumentRoot at http://example.com/, # uncomment the following line: # RewriteBase / # Rewrite URLs of the form 'x' to the form 'index.php?q=x'. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_URI} !=/favicon.ico RewriteRule ^(.*)$ index.php?q=$1 [L,QSA] </IfModule> The bit that I have added to the file was # rewrite for the mdg transformation pages RewriteEngine on RewriteRule ^anothercompany$ mgd-trans-campaign/index.php?var=Another-Company [NC,L] RewriteRule ^birkdalehighschool$ mgd-trans-campaign/index.php?var=Birkdale-High-School hope this helps
  3. OK thanks AyKay47, I have created two simple rewrites just to test the page content and the page is loading but the variables are not being picked up on the page. This is the code I use for the page to grab whats in the var part of the URL <?php function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } ?> <?php $url = curPageURL(); parse_str(parse_url($url, PHP_URL_QUERY), $vars); $name = $vars['var']; $customer = str_replace("-"," ",$name); ?> And then I use this to output: <?php echo "Dear $customer\n"; This works fine if I manually type the url www.domain.com/folder1/page.php?var=Firstname-Surname BUT doesnt work when I do the rewrite: RewriteRule ^firstnamesurname$ folder1/page.php?var=Firstname-Surname [NC,L]
  4. Just to add more context to my question and to make it more complex! I have a big list of company names i.e. acme company, red widgets ltd and I want to send out a mailshot with URLs as www.domain.com/acmecompany www.domain.com/redwidgetsltd ...etc Can I grab these specific keywords and rewrite them so that I can have something like www.domain.com/user.php?company=acme-company And consequently I am then able to use that variable within my page copy? I can't get my head round the situation when there are a lot of words in a company name AND how do I separate words in the company name?? eddy
  5. Guys I appreciate all your help. So can I rewrite a URL using: www.domain.com/keyword1keyword2 to www.domain.com/user.php?username=keyword1-keyword2
  6. Great thanks, is it possible to get the info for the rewrite from a CSV file? i.e. Name, new URL, old url Joe Bloggs, domain.com/joe domain.com/user.php?username=Joe
  7. Of course, perfect! I will that a go, dont suppose you can recommend a good resource that I can read?
  8. Hi all, I'm not a seasoned PHP developer but learning all the time! However I am stumped at creating a solution that can do the following: I have a list of names of people (first name and surname) that I have in a CSV file. I know roughly how to read in data from a CSV file which is great as this means that I can customise the greeting of a personalised web page. What I am struggling with is to create personal URLs also. So for example I want to be able to create a personal URL such as www.domain.com/firstnamesurname/ and then this page I can add a personalised greetings etc. Is this possible? Any advice would be greatly appreciated. eddy
×
×
  • 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.