.htaccess many URL rewriting

I have this rule:

RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ profil.php?upime=$1 

and it works. Now I want to know how to rewrite the URL of another page:

 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ profil.php?upime=$1 RewriteRule ^(.*)$ novica.php?nid=$2 - I did this, but is not working. 

what can i do that i will have both rules in one .htaccess file?

+4
source share
1 answer

You cannot do this, as in your example, when you rewrite everything: ^(.*)$ .

If you need two different rules, you will need to choose which URLs you want to write to your final destination.

Example when you rewrite different URLs starting with different lines to different destinations:

 RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^starts_with_this(.*)$ profil.php?upime=$1 RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^starts_with_something_else(.*)$ novica.php?nid=$1 
+5
source

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


All Articles