URL friendly in two subdirectories

Asked

Viewed 163 times

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 own htaccess...

  • Correct! I did that, inside the admin directory has this . htaccess there above.

  • What happens when you access the url www.site.com.br/coletor/admin/cadastrar?

  • www.site.com.br/collector/admin/register/? p=register

  • Redirect to this one?

  • Yeah, you redirected to that

  • 1

    See your PHP, because RewriteRule does not redirect, just rewrite the URL to PHP.

  • on the link I am putting: <a href="/collector/admin/register">link</a>

  • Add the following rule: RewriteRule ^([a-z_-]+)\/([a-z_-]+)\/([a-z_-]+)\/$ index.php?p=$1&s=$2&c=$3

Show 4 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.