Reputation: 2187
I have the following rule in my .htaccess
file.
RewriteRule ^(segment1|segment2)/(.*)$ $1/#$2 [R=301,NE,L]
The intent is to prepend a #
to the last part of the URL. But I run into a redirect loop issue. I don't know why as I applied L
flag.
What I want to achieve is, for example:
Turn:
http://example.com/segment1/test
into:
http://example.com/segment1/#test
Any advice would be much appreciated!
Thanks!
Upvotes: 0
Views: 61
Reputation: 8741
This is tested in Debian/Apache2:
RewriteEngine On
RewriteRule ^(segment1|segment2)/([^#]+)$ /$1/#$2 [R=301,NE,L]
The [L] flag only ends the current run of rewrite, as URI changes, it will continue to rewrite, so you've an infinite loop.
Upvotes: 1