diff --git a/.htaccess b/.htaccess
new file mode 100644
index 0000000000000000000000000000000000000000..738c31f343406658eab03bf7e96f1243f71fefaa
--- /dev/null
+++ b/.htaccess
@@ -0,0 +1,4 @@
+RewriteEngine on
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteRule ^(.*)$ index.php [QSA,L]
diff --git a/index.php b/index.php
index 91ef4fa5dfe49d1c770673ecb457c8e014b5c94d..c46329bb0ca5eb7c30c9d37cb1713c4cfbfbb222 100644
--- a/index.php
+++ b/index.php
@@ -652,6 +652,7 @@ $origin_domain = strtolower( $exploded[1] );
 $origin_domain_exception = array_key_exists( $origin_domain, $origin_domain_exceptions ) ? $origin_domain_exceptions[$origin_domain] : 0;
 
 $scheme = 'http' . ( array_key_exists( 'ssl', $_GET ) ? 's' : '' ) . '://';
+
 parse_str( ( empty( $parsed['query'] ) ? '' : $parsed['query'] ),  $_GET  );
 
 $ext = strtolower( pathinfo( $parsed['path'], PATHINFO_EXTENSION ) );
@@ -663,10 +664,10 @@ $url = $scheme . substr( $parsed['path'], 1 );
 $url = preg_replace( '/#.*$/', '', $url );
 $url = apply_filters( 'url', $url );
 
-if ( isset( $_GET['q'] ) ) {
+if ( isset( $parsed['query'] ) ) {
 	if ( $origin_domain_exception & PHOTON__ALLOW_QUERY_STRINGS ) {
-		$url .= '?' . preg_replace( '/#.*$/', '', (string) $_GET['q'] );
-		unset( $_GET['q'] );
+		$url .= '?' . preg_replace( '/#.*$/', '', (string) $parsed['query'] );
+		unset( $parsed['query'] );
 	} else {
 		httpdie( '400 Bad Request', "Sorry, the parameters you provided were not valid" );
 	}