TheCow
TheCow

Reputation: 11

.htaccess rewrite problems (& show new url)

I'm trying to redirect domain.com/players/ to domain.com/players/index.php?p=profile&player= without any success. I asked some simple stuff yesterday and tried

RewriteRule ^(.*)$ domain.com/players/index.php?p=profile&player=$1 [L]

but it just didn't redirect me? Currently my .htaccess looks like this:

Options -Indexes +FollowSymLinks
RewriteEngine On
RewriteBase /players/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ domain.com/players/index.php?p=profile&player=$1 [L]

I also had "RewriteCond %{REQUEST_FILENAME} !-f", but could find out what it does.

This works a bit, but there is still few problems. One of the problems is that I can't access domain.com/players. It redirects me to domain.com/players/index.php?p=profile&player=index.php

And the other thing is that I would still have domain.com/players/ in my url bar. Is it possible so it shows the content of domain.com/players/index.php?p=profile&player=, but shows domain.com/players/ in the url bar? I think it looks ugly for other users.

I'm sorry, I'm really beginner in using .htaccess, but I have tried to research before posting this.

Upvotes: 0

Views: 23

Answers (2)

TheCow
TheCow

Reputation: 11

Solved!

Changed

RewriteRule ^(.*)$ domain.com/players/index.php?p=profile&player=$1 [L]

to

RewriteRule ^(.*)$ /players/index.php?p=profile&player=$1 [NC,L]

Upvotes: 1

Raju Lamsal
Raju Lamsal

Reputation: 81

Try this

Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} example.com$ [NC]
RewriteCond %{HTTP_HOST} !folder1
RewriteRule ^(.*)$ http://example.com/folder1/$1 [R=301,L]

Upvotes: 0

Related Questions