Rewriting or omitting certain parts of URL

Avatar
  • Answered
Im working on a php website. The URL of the webpages on the website displays the containing folder names as well as their sub folder. It reads something like:
URL for search products page: Example.com/folder1/subfolder1/searchproducts
And
URL for product details page: Example.com/folder1/subfolder1/searchproducts/productdetails

The .htaccess file present in this particular folder- folder1 contains only the following lines of code:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?action=$1 [QSA,L]


In the URL’s of the webpages, we would like to rewrite / change the name of the folders and subfolders. Or else we could hide the folder and subfolder names to change the URL from: ‘Example.com/folder1/subfolder1/searchproducts’ to ‘Example.com/searchproducts’.

What are the easiest possible ways for doing this. Would appreciate the help.
Avatar
CaseyB
Hello,

Thank you for your question about constructing a custom .htaccess rewrite. As this has to do with making custom changes to the coding of your site or sites, it is outside of the scope of support that we are able to provide. You will want to work with an experienced web developer, if you don't have one already, to assist you in resolving this.

Gratefully,
Casey B.