So I have looked into this and so long as you are careful not to create rewrite rules that contradict each other then I can see no issue. On a side note, I have read that it is not a great idea to have too many rewrite rules in the .htaccess file as it slows things down a little.
Any issues with using wildcards in htaccess file?
-
17-07-2023 - |
سؤال
I have the following rewrite in my htaccess file:
RewriteRule residential-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)-(.*)\.html$ http://MYDOMAIN.COM/listing.php?type=rent&recordID=$7
I then use a function to build the final URL - here is an example of one possible URL: residential-house-for-rent-sa-adelaide+hills-aldgate-895.html
The reason I have used wildcards is because there are many thousands of possible combinations which I do not want to explicitly state in the htaccess file. The only element within the URL that actually controls the final output of the page is the recordID.
My question is - are there any issues that I should be aware of with using so many wildcards in building the URL ? My concern is that ultimately a user can type anything as a URL, so long as it fits with the patterns required in the htaccess file and so long as a record ID is in position $7, and it will reach a page. I am unsure if this will have any detrimental impact on SEO or Google crawling of the site or whether there are any other potential issues that I need to think about with this structure ?
Any help is appreciated :-)
المحلول