Php rewrite url via .htaccess

I want to rewrite some url using .htaccess rewrite

I have a url something like this:

domain.com/app/index.php/appmedia/default/login

and want to rewrite users to

domain.com/app/index.php/zurmo/default/login

So, what will happen, users will see applications in the browser, but in the backend there will be access to zurmo

I am new to php and read some blogs like this no luck

Also tried it

RewriteEngine On RewriteRule ^app/index.php/appmedia/default/login.*$ http://domain.com/app/index.php/zurmo/default/login [R=301,L] 

he says the page is not redirecting correctly

Edit .htaccess file

 RewriteEngine On RewriteRule ^app/index.php/appmedia/default/login.*$ http://mydomainx.com/app/index.php/zurmo/default/login [R=301,L] 
+5
source share
1 answer

You cannot use [R=301] and expect the URL to not change. R stands for redirection. This way it will change to the URL you told him. For internal rewriting you need to leave this.

If you have .htaccess at the root of your document, you should do this. I don’t know how your setup is, but this should rewrite the URI.

 Options -Multiviews RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^app/index.php/appmedia/default/login/?$ /app/index.php/zurmo/default/login [L] 

If you are using the yii framework , follow these steps:

 'urlManager' => array ( 'class' => 'application.core.components.ZurmoUrlManager', 'urlFormat' => 'path', 'caseSensitive' => true, 'showScriptName' => true, 'rules' => array( // Begin Not Coding Standard // API REST patterns array('zurmo/default/login','pattern' => 'appmedia/default/login', 
+2
source

Source: https://habr.com/ru/post/1216085/


All Articles