Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Apache mod_rewrite

I'm using Liferay 6.2 EE that runs on tomcat but it's fronted by an Apache server. I want to redirect users so that whenever they hit the old liferay URL, it redirects them to the new liferay URL. I changed the URL in liferay, so it is now the new URL. However, whenever I try to go to the old URL, I get a page request error. It never redirects me to the new URL. In /san/apache/conf/ I put my redirect code inside of httpd.conf. This my code:

RewriteEngine On
RewriteRule ^group/old/(.*) /group/new/$1 [L]

After I applied these changes, I restarted the Apache server and it still doesn't work. I've tried a bunch of other combinations as well. Does anyone know what I'm doing wrong? Is there some place else I have to make this change?

like image 945
Samantha Avatar asked Jun 06 '26 01:06

Samantha


1 Answers

Ah, since your rewrite rule is lying in the server config file (instead of htaccess file), the mod-rewrite receives URLs with the leading slashes (/). So, the rule should be:

RewriteEngine On
RewriteRule ^/group/old/(.*) /group/new/$1 [L]
like image 123
hjpotter92 Avatar answered Jun 08 '26 00:06

hjpotter92



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!