watsmyname Posted October 24, 2011 Share Posted October 24, 2011 Hello I have following code on htaccess RewriteEngine on RewriteRule ^([A-Za-z_0-9\-]+[^\.\?/]+)/?$ profile.php?username=$1 [L] Above code only allows alphanumeric character or alphanumeric characters with period at the end. All i want to do is to re-write http://www.mydomain.com/profile.php?username=john.smith to http://www.mydomain.com/john.smith username might be johnsmith or john.smith or john.smith9.doe and so on. SO precisely, alphanumeric characters and periods are allowed. Any help will be much appreciated Thanks Link to comment https://forums.phpfreaks.com/topic/249684-mod-rewrite-not-working/ Share on other sites More sharing options...
cags Posted October 25, 2011 Share Posted October 25, 2011 If a period is a required character, just add it into the first character set. Incidentally I see you are checking that the request doesn't end in a question mark. The query_string question mark is not part of the string tested against, not I believe a URL safe character. Link to comment https://forums.phpfreaks.com/topic/249684-mod-rewrite-not-working/#findComment-1282001 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.