I try to redirect my dynamic url to a static url. I almost achieved this goal. But after opening the static url it will redirect to thefull path of my server. For example:
Actual link (dynamic)
https://example.com/product?id=755&supermarket=albert-heijn&product=ah-roerbak-hollands-brocc-pomp-spitskool
desired link (static)
https://example.com/product/755/albert-heijn/ah-roerbak-hollands-brocc-pomp-spitskool
Result (static redirects to)
https://example.com/home/name/public_html/product/755/albert-heijn/ah-roerbak-hollands-brocc-pomp-spitskool/
My .htaccess is located inside my public_html folder, and there are no other .htaccess files on the server.
RewriteEngine on
# convert static url
RewriteRule /product/(.*)/(.*)/(.*)$ product.php?id=$1&supermarket=$2&name=$3
<IfModule mod_expires.c>
ExpiresActive on
ExpiresByType text/javascript "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType text/css "access plus 1 month"
ExpiresByType image/jpg "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
</IfModule>
Try setting
RewriteBase /
Or, if not works,
RewriteBase /home/name/public_html/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.