Hillbilly Posted September 18, 2019 Share Posted September 18, 2019 Hi, My htaccess has a this ReWriteRule which works perfectly:RewriteRule ^browse/([A-Za-z\+\-]+)/([A-Za-z\+\-]+)/?$ browse.php?type=$1&category=$2 However sometimes I see the variables included in the URL bar. Eg:https://www.mysite.com/browse/on-road/lights?type=on-road&category=lights Other links are fine:https://www.mysite.com/browse/on-road/worklights I cant tell why only a few select links show the variables. Any help would be appreciated. Here is my full htaccess file - some bits added for SEO: <if "%{HTTPS} == 'on'"> Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload" </if> ErrorDocument 404 /404.php <IfModule mod_rewrite.c> Options -MultiViews ## Base Redirects ## # Turn on Rewrite Engine RewriteEngine On # Redirect to secure HTTPS before changing host RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC] RewriteCond %{https} off RewriteRule ^(.*)$ https://mysite.com/$1 [R=301,L] # Remove trailing slash from non-filepath urls RewriteCond %{REQUEST_URI} /(.+)/$ RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^ https://www.mysite.com/%1 [R=301,L] # Include trailing slash on directory RewriteCond %{REQUEST_URI} !(.+)/$ RewriteCond %{REQUEST_FILENAME} -d RewriteRule ^(.+)$ https://www.mysite.com/$1/ [R=301,L] # Force HTTPS and WWW RewriteCond %{HTTP_HOST} !^www\.(.*)$ [OR,NC] RewriteCond %{https} off RewriteRule ^(.*)$ https://www.mysite.com/$1 [R=301,L] # For product categories: RewriteRule ^browse/([A-Za-z\+\-]+)/([A-Za-z\+\-]+)/?$ browse.php?type=$1&category=$2 # For specific product: RewriteRule ^products/([A-Za-z\+\-]+)/([0-9a-zA-Z-]+)/?$ products.php?category=$1&SEOpagename=$2 </IfModule Link to comment Share on other sites More sharing options...
Hillbilly Posted September 18, 2019 Author Share Posted September 18, 2019 ok - now I see that it is just the last link in each of my drop down menu lists that show the variables in the URL bar when clicked? The links look EXACTLY the same to the other links in the drop down menu (dynamically created). Any ideas anyone? Im going around in circles here... Here is the html of a drop down menu - the highlighted link shows the variables once clicked? (its always the last link that does this) <ul class="menu photo-dropdown submenu is-dropdown-submenu first-sub vertical js-dropdown-active" data-submenu="" role="menu" style=""> <li class="cell is-submenu-item is-dropdown-submenu-item" role="menuitem"> <a href="/browse/off-road/worklights/"> <img src="/products/menu_work_light.jpg" alt="Work Lights"> <br>Work Lights</a> </li> <li class="cell is-submenu-item is-dropdown-submenu-item" role="menuitem"> <a href="/browse/off-road/lightbars/"> <img src="/products/menu_lightbars.jpg" alt="Lightbars"> <br>Lightbars</a> </li> </ul> Link to comment Share on other sites More sharing options...
daviddawn Posted September 19, 2019 Share Posted September 19, 2019 HI, "The links look EXACTLY the same to the other links in the drop down menu (dynamically created)." can you provide the php code for this ? Regards David Link to comment Share on other sites More sharing options...
Hillbilly Posted September 25, 2019 Author Share Posted September 25, 2019 Hi David - sorry for the late response: Code is as follows //fetch data $r = mysqli_query($dbc, "SELECT * FROM categories WHERE master_category = 'on-road' ORDER by id;"); // create variable $on_road_products_basic_menu = ''; //create links while ( $row = mysqli_fetch_array( $r, MYSQLI_ASSOC ) ) { if ( $r ) { $on_road_products_basic_menu .= '<li> <a href="/browse/'.$row['master_category'].'/'.$row['category'].'/"> '.$row['display_name'].'</a> </li>'; } } Link to comment Share on other sites More sharing options...
Larry Posted September 25, 2019 Share Posted September 25, 2019 This is strange. There's nothing in your PHP code that would explain this. Could you confirm the exact sequence of events and the result? So you're on a page with what specific URL? And then you click what specific link (and what is that specific URL)? And then the resulting URL is what? Link to comment Share on other sites More sharing options...
Hillbilly Posted September 28, 2019 Author Share Posted September 28, 2019 Hi Larry, You can view yourself - the site is live: www.ltprtz.co.uk If you select the (for eg) "On Road Lights" and then choose one of the drop down menu links: All the menu links EXCEPT the last menu link will link correctly: Ie: The resultant page will open and the link will display:/browse/on-road/headlights However - the last menu item in this drop down - in our case "Round Driving Lights", when clicked, will show:/browse/on-road/driving-round-lights?type=on-road&category=driving-round-lights This is the same across all the product menu items. I'm stumped. Link to comment Share on other sites More sharing options...
daviddawn Posted September 29, 2019 Share Posted September 29, 2019 Hi, I have tested the site live and its all working my end. It may be obvious but your cache on your browser may be causing this, clear your browser cache and try another browser, also, are you testing locally or on the live site ? Regards David Link to comment Share on other sites More sharing options...
Larry Posted September 30, 2019 Share Posted September 30, 2019 Yeah, I think David has it. It works fine for me too. Link to comment Share on other sites More sharing options...
Hillbilly Posted October 2, 2019 Author Share Posted October 2, 2019 Perfect! I should have tried that first and saved myself alot of effort!I was testing on both IE and Chrome and both were giving the same issues - now cleared. (Site was already live when the issues showed up)Thank you for your input. Now my mind is at ease. Link to comment Share on other sites More sharing options...
daviddawn Posted October 3, 2019 Share Posted October 3, 2019 Glad to hear you got it sorted! As a side note, when developing its good to test your site on 4 -5 different browsers (Firefox being my favorite) as they all behave differently, most noticeably IE. Nice color theme by the way ! Link to comment Share on other sites More sharing options...
Recommended Posts