0

I have a search results page that needs to accept 3 parameters. I am using _GET to pass the variables to the search page and it works great. I rewrote the URL via HTACCESS and the URL rewrites properly but the page has no results and when I try to echo any of the $_GET variables they come back as 0 even though they are displaying in the URL as a positive number.

I tried moving L to the end of the options and simplifying it down to 1 parameter in case I was missing something tiny but I just cant figure it out.

Options -MultiViews
<IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine on
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    # FOR GODADDY
    RewriteRule ^(.*)$ index\.php?/$1 [QSA,L]
    RewriteCond %{THE_REQUEST} /en/show/fun_things_to_do/\?county=([^&\s]+)&city=([^&\s]+)&category=([^&\s]+)&url=([^&\s]+)\s [NC]
RewriteRule ^ /en/show/fun_things_to_do/%1/%2/%3/%4? [R=301,L,NE]

RewriteRule ^en/show/fun_things_to_do/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ en/show/fun_things_to_do/?county=$1&city=$2&category=$3&url=$4 [QSA,L,NC]
</IfModule>
<IfModule mod_rewrite.c>
RewriteEngine On
Redirect 301 /en/admin/auth /en/
</IfModule>
# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php56” package as the default “PHP” programming language.
<IfModule mime_module>
  AddType application/x-httpd-ea-php56 .php .php5 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

I was expecting the $_GET variables to still work through rewriting but Im thinking that I have a conflict somewhere in the htaccess that Im not seeing.

  • To clarify the lines in question on the htaccess are the following the rest of it works and was working previously: `RewriteCond %{THE_REQUEST} /en/show/fun_things_to_do/\?county=([^&\s]+)&city=([^&\s]+)&category=([^&\s]+)&url=([^&\s]+)\s [NC]` `RewriteRule ^ /en/show/fun_things_to_do/%1/%2/%3/%4? [R=301,L,NE]` `RewriteRule ^en/show/fun_things_to_do/([^/]+)/([^/]+)/([^/]+)/([^/]+)/?$ en/show/fun_things_to_do/?county=$1&city=$2&category=$3&url=$4 [QSA,L,NC]` – Daniel Yeager Apr 03 '19 at 23:23
  • Possible duplicate of [.htaccess rewrite GET variables](https://stackoverflow.com/questions/7677070/htaccess-rewrite-get-variables) – Yassine CHABLI Apr 03 '19 at 23:27
  • But if that were the case the get wouldnt work without the rewrite either. It works until I do the rewrite so if the url is county=1&city=2&category=3 it works fine but when it is rewritten to 1/2/3/ it doesnt work anymore thats my confusion – Daniel Yeager Apr 04 '19 at 20:41

0 Answers0