Forum

Thread tagged as: Configuration

htaccess with slug querystring

https://www.mydomain.com/products/productgroup/?s=myproductname

I'd like it to be:

https://www.mydomain.com/products/productgroup/myproductname

my productgroup page uses the s variable to select a page from a collection - i'm trying wrap my head around how perch interprets the url.

Any tips for coding the .htaccess and any other caveats I should be aware of. (I'm not sure why, but the syntax for .htaccess is perplexing to me).


my current htaccess is:

RewriteEngine On
RewriteCond %{REQUEST_URI} !^/perch 
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /perch/core/runway/start.php [L] 

Many thanks in advance. Free beer if you're in the southeast Wisconsin area :)

Raymond Wiggins

Raymond Wiggins 0 points

  • 6 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

You don't need to change your htaccess for this, you can just do it from the control panel.

From the page in the control panel, go to Page Options and look for the Routes section.

Add a new URL pattern:

products/productgroup/[slug:s]

The [bracketed] part means "match a slug, and refer to it as s".

That's all you need to do to get the page to match. Be sure to update the links in your template to use the new URL format.