3

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]
3
  • What server-side language are you using to process query strings and what is the default document name (e.g., index.php)? Commented Dec 30, 2013 at 23:45
  • I'm using apache, and it's name is index.php Commented Dec 30, 2013 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. Commented Dec 31, 2013 at 10:53

1 Answer 1

2

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.

11
  • Still getting a blank page. Commented Dec 30, 2013 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 Commented Dec 30, 2013 at 23:58
  • I have mod_rewrite installed and enabled. But this still didn't work :/ Commented Dec 31, 2013 at 0:12
  • Be sure to completely clear the cache in your browser. I assume the home page is not blank, correct? Commented Dec 31, 2013 at 0:14
  • Still blank, I tried clearing cache too. Commented Dec 31, 2013 at 0:17

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.