0
I’m trying to make the url friendly with . htaccess therein:
RewriteEngine On
RewriteRule ^([a-z_-]+)$ index.php?p=$1
RewriteRule ^([0-9]+)$ index.php?g=$1
RewriteRule ^([a-z_-]+)\/([0-9]+)$ index.php?p=$1&c=$2
RewriteRule ^([a-z_-]+)\/([a-z_-]+)$ index.php?p=$1&s=$2
RewriteRule ^([a-z_-]+)\/([a-z_-]+)\/([0-9]+)$ index.php?p=$1&s=$2&c=$3
And I have the following structure:
www.site.com.br/collector/admin/index.php? p=register
When I run it gets like this:
www.site.com.br/collector/admin/register/? p=register
and the screen is all white.
What is your directory structure, where you are placing the
htaccess
? Each folder must have its ownhtaccess
...– KaduAmaral
Correct! I did that, inside the admin directory has this . htaccess there above.
– Charles S. Ferreira
What happens when you access the url
www.site.com.br/coletor/admin/cadastrar
?– KaduAmaral
www.site.com.br/collector/admin/register/? p=register
– Charles S. Ferreira
Redirect to this one?
– KaduAmaral
Yeah, you redirected to that
– Charles S. Ferreira
See your PHP, because
RewriteRule
does not redirect, just rewrite the URL to PHP.– KaduAmaral
on the link I am putting: <a href="/collector/admin/register">link</a>
– Charles S. Ferreira
Add the following rule:
RewriteRule ^([a-z_-]+)\/([a-z_-]+)\/([a-z_-]+)\/$ index.php?p=$1&s=$2&c=$3
– Papa Charlie