Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I can't figure out how to make users visiting my website using links like: mysite.com/?ref=XXXXXXX see the homepage instead of a completely blank page. I tried using htaccess but I can't figure out how to do it.

This is how my .htaccess file looks like:

Options +FollowSymLinks -MultiViews

RewriteEngine On

RewriteCond %{QUERY_STRING} ^ref=(.+)$ [NC]

RewriteRule ^index.php http://mysite.com/? [L,R=301]
share|improve this question
    
What server-side language are you using to process query strings and what is the default document name (e.g., index.php)? –  dan Dec 30 '13 at 23:45
    
I'm using apache, and it's name is index.php –  user34853 Dec 30 '13 at 23:46
    
(I realise you've solved this, but...) If you are accessing mysite.com/?ref=XXXXXXX then your RewriteRule ^index.php... is never going to match. –  w3d Dec 31 '13 at 10:53

1 Answer 1

up vote 1 down vote accepted

Try adding this to a .htaccess file in your document root:

Options +FollowSymLinks -MultiViews

RewriteEngine On

RewriteCond %{QUERY_STRING} ^ref=(.+)$ [NC]
RewriteRule ^index.php$ /? [L,R=301,NC]

Make sure you have the mod_rewrite module installed.

share|improve this answer
    
Still getting a blank page. –  user34853 Dec 30 '13 at 23:56
    
Try this then: RewriteRule ^index.php http://mysite.com/? [L,R=301] Also be sure to check that mod_rewrite is installed and enabled in your httpd.conf –  dan Dec 30 '13 at 23:58
    
I have mod_rewrite installed and enabled. But this still didn't work :/ –  user34853 Dec 31 '13 at 0:12
    
Be sure to completely clear the cache in your browser. I assume the home page is not blank, correct? –  dan Dec 31 '13 at 0:14
    
Still blank, I tried clearing cache too. –  user34853 Dec 31 '13 at 0:17

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.