Click here to Skip to main content
14,879,246 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a url:

I would like this url to work too on

I tried :

RewriteRule ^ [L,R=301]

Dows not work...
How to do it on .htaccess?
Updated 5-Aug-13 7:45am

1 solution

There are quite a few options, so feel free to take whichever one works for your particular setup.

If you want to use /p/1 in links, text, whatever -- and have it rewrite to /products/game.php (using it as a URL shortener):
Options +FollowSymLinks
RewriteEngine On
RewriteRule ^p/1/?$ [R=301,L]

If you want /p/1 to display the contents of /products/game.php but still use the shorter URL in the address bar:
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/p/1/?$ [NC]
RewriteRule .* /products/game.php [QSA, L]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900