Allan Frost Posted September 3, 2024 Share Posted September 3, 2024 Hi all I have added the products main category in the url structure on my ps 1.7 store. It looks like all is working fine, exept the rewrite from the old url. If I type in the old url it will redirect to the new url, as it should. But it adds "?category_rewrite=" to the url. It look like this. Old url: shop.com/produkt New url: shop.com/category/product?category_rewrite=product The canonical tag then gives the correct url: shop.com/category/product Anyone knows how to remowe the ?category_rewrite=product Link to comment Share on other sites More sharing options...
Knowband Plugins Posted September 4, 2024 Share Posted September 4, 2024 Create an override for the Dispatcher class or the specific controller that handles product and category URLs. This is usually found in controllers/front/CategoryController.php class CategoryController extends CategoryControllerCore { public function init() { parent::init(); // Check for the category_rewrite parameter and remove it if present if (isset($_GET['category_rewrite'])) { $url = preg_replace('/\?category_rewrite=.*/', '', $_SERVER['REQUEST_URI']); Tools::redirect($url, __PS_BASE_URI__); } } } Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now