0
votes

I need help with a clean URL in CakePHP. I've been trying for a while with no luck.

This is the existing htaccess


    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]

This is the URL that I'm trying to clean up:

http://example.com/signup/?key=dT33Y%2FeKXCjgeo69XpTs39YV%2F4ZnHht0M5E%2BXk9iDKQ%3D

I would like the URL to look like this:

http://example.com/signup/dT33Y%2FeKXCjgeo69XpTs39YV%2F4ZnHht0M5E%2BXk9iDKQ%3D

Please help. Thank you!

1

1 Answers

1
votes

Try this code in /signup/.htaccess:

RewriteEngine On

RewriteCond %{THE_REQUEST} /signup/\?key=([^\s&]+) [NC]
RewriteRule ^ %1? [R=302,L,NE]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^/]+)/?$ ?key=$2 [L,QSA]