I’m struggling with a problem trying to rewrite a url without changeing its content.
I want to display in browser url a different url, but the content still the same
My url is http://fortin.agency/audit-seo/frtcrwl/health_check/report/578/leasingautomobile.ro
And i wanna change it to http://fortin.agency/audit-seo/578/leasingautomobile.ro
What i’ve done:
Options +FollowSymlinks
RewriteEngine on
RewriteRule ^frtcrwl/health_check/report/(.*)$ /$1 [L,NC,R=301,NE]
Doesnt work… Any help?
EDIT
578 in the url is dynamic, also the “leasingautomobile.ro”
EDIT #2
Final code:
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} ^/(audit-seo)/frtcrwl/health_check/report/(.+)$ [NC]
RewriteRule ^ /%1/%2 [L,R=301,NE]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php?/$0 [PT,L]
Still not working as expected yet as it throws error 404. Can the path remain unchanged? Coz the url in browser link now is perfect. Thanks to @anubhava till now
2
Answers
Change your rule to this and retest inside
frtcrwl/.htaccess
If you want to be abble to access
http://fortin.agency/audit-seo/frtcrwl/health_check/report/578/leasingautomobile.ro
fromhttp://fortin.agency/audit-seo/578/leasingautomobile.ro
you can use the following rules: