user2491321
user2491321

Reputation: 673

cut more than one url with htaccess

I have a folder with all my files. The folder includes a file with the profile and file with the wall in a social network that I am building. The link for the profile is for example : [email protected] and displays the profile for the test user. I use htaccess to change link:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /social_network/profile.php?email=$1

I also have the wall page called wall.php. I want insetad of social_network/wall.php to display : social_network/welcome any idea how to do this?

Upvotes: 1

Views: 39

Answers (2)

anubhava
anubhava

Reputation: 785856

You can have a new rule for handling wall:

RewriteEngine On

# wall requests
RewriteRule ^welcome/?$ /social_network/wall.php [L,NC]

# profile requests
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /social_network/profile.php?email=$1 [L,QSA]

Upvotes: 1

jabbink
jabbink

Reputation: 1291

You could try this:

RewriteEngine On
RewriteRule ^welcome$ /social_network/wall.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /social_network/profile.php?email=$1

To some extent you can test RewriteRules here: http://htaccess.madewithlove.be/

Upvotes: 1

Related Questions