Reputation: 7448
I have an application with URLs such as these:
https://www.domain.com/example/public/subscription
https://www.domain.com/example/public/subscription/source
https://www.domain.com/example/public/test/subscription
I'd like to use mod_rewrite (or some other method) to create shorter "aliases" of the above URLs by removing the /public/
part so that I can provide my client with these shorter versions of the URLs:
https://www.domain.com/example/subscription
https://www.domain.com/example/subscription/source
https://www.domain.com/example/test/subscription
In other words, when browsing to https://www.domain.com/example/subscription
, for example:
https://www.domain.com/example/public/subscription
directly/public/
) in the address barIs this even possible, and how would such a RewriteRule look like?
Thank you in advance.
Upvotes: 0
Views: 569
Reputation: 15778
You just want to "remove" the public
keyword?
Try this rewrite rule:
RewriteRule ^/example/public/(.*) /example/$1 [L]
Upvotes: -1
Reputation: 12727
put this is .htaccess
file in your DocumentRoot
.
Options +FollowSymLinks -Indexes -MultiViews
RewriteEngine on
RewriteBase /
RewriteRule ^(example)/(.*)$ $1/public/$2 [NC,L]
Upvotes: 2