Pergunta

my question has two parts.

first what does this mean?

Rewriterule ^(.*)$ http://www.somedomain.com/$1 [r=301,nc]

and the second part is that i want to Rewrite this

somedomain.com/somename

to go to

somedomain.com/index.php?page=user&p=somename

if you are providing me a new code do i have to replace the code mentioned above?

Foi útil?

Solução

The short simple answer.

Rewriterule ^(.*)$ http://www.somedomain.com/$1 [r=301,nc]

This rule will match anything after the / and the 2nd part of the rule will take that match and add it after the domain name of www.somedomain.com and then redirect that new URL. The new URL will be shown in the address bar.

For what you want to do, that rule won't work. You will need to do this.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
Rewriterule ^(.+)$ index.php?page=user&p=$1 [L]

This will be an internal redirect so that what shows in your address bar will be a URL like

http://somedomain.com/somename
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top