hi friends, am modrewriting my user profile url. Iz nw 'www.mysite.com/username' with that url u can acces user profile direct. But the problem am facing is that if a user UserName Contain '.' eg. 'Www.mysite.com/junkle.junk' it will not open rather its sh0wing me page n0t f0und. Pls hw do i ge rid of it . Tanx
							
						
					help on modrewrite problem
				
					Collapse
				
			
		
	X
- 
	
	
	
		
	
	
		
		
		
		
		
		
		
	
	
 - 
	
	
	
		
	
	
		
		
		
		
		
		
		
	
	
Thiz iz my full .htacess file c0de:
Code:<IfModule mod_rewrite.c> RewriteEngine On Options -Indexes Options +FollowSymlinks RewriteRule ^(.*)\.html$ $1.php [nc] RewriteRule ^([a-zA-Z0-9_-]+)$ userinfo.php?user=$1 [L] RewriteRule ^([a-zA-Z0-9_-]+)/$ userinfo.php?user=$1 [L] RewriteEngine On RewriteCond %{HTTP_HOST} ^[url=http://www.mysite.com]Website Hosting - Mysite.com[/url] RewriteRule (.*) http://mysite.com/$1 [R=301,L] # proc/self/environ? no way! RewriteCond %{QUERY_STRING} proc/self/environ [OR] # Block out any script trying to set a mosConfig value through the URL RewriteCond %{QUERY_STRING} mosConfig_[a-zA-Z_]{1,21}(=|\%3D) [OR] # Block out any script trying to base64_encode crap to send via URL RewriteCond %{QUERY_STRING} base64_encode.*(.*) [OR] # Block out any script that includes a <script> tag in URL RewriteCond %{QUERY_STRING} (<|%3C).*script.*(>|%3E) [NC,OR] # Block out any script trying to set a PHP GLOBALS variable via URL RewriteCond %{QUERY_STRING} GLOBALS(=|[|\%[0-9A-Z]{0,2}) [OR] # Block out any script trying to modify a _REQUEST variable via URL RewriteCond %{QUERY_STRING} _REQUEST(=|[|\%[0-9A-Z]{0,2}) # Send all blocked request to homepage with 403 Forbidden error! RewriteRule ^(.*)$ index.php [F,L] </IfModule>Last edited by metulj; 26.07.13, 05:23.
Comment
 - 
	
	
	
		
	
	
		
		
		
		
		
		
		
	
	
i did that but i got an eror..Code:RewriteRule ^([a-zA-Z0-9_-\.]+)$ userinfo.php?user=$1 [L] RewriteRule ^([a-zA-Z0-9_-\.]+)/$ userinfo.php?user=$1 [L]
that 0ne affect all my page saying user n0t found. Even with this bel0wCode:RewriteRule ^([a-zA-Z0-9_\-\.]+)$ userinfo.php?user=$1 [L] RewriteRule ^([a-zA-Z0-9_\-\.]+)/$ userinfo.php?user=$1 [L]
andCode:RewriteRule ^([a-zA-Z0-9-.]+)$ userinfo.php?user=$1 [L] RewriteRule ^([a-zA-Z0-9-.]+)/$ userinfo.php?user=$1 [L]
Code:RewriteRule ^([a-zA-Z0-9_.]+)$ userinfo.php?user=$1 [L] RewriteRule ^([a-zA-Z0-9_.]+)/$ userinfo.php?user=$1 [L]
Last edited by Junkle; 06.08.13, 02:30.
Comment
 - 
	
	
	
		
	
	
		
		
		
		
		
		
		
	
	
if you want any letters or symbols to be matched as a user name use:
by limiting the match to only: a-z A-Z 0-9 _ \- \. it is not matching against anything with / in the username - or alternatively you can add the forward slash into the matched symbols: a-zA-Z0-9_\-\.\/PHP Code:RewriteRule ^.*$ userinfo.php?user=$1 [L]
just remember to write rules to make sure folders like /images/ are still accessible and you may want to block users from using your folder names in your script also.
Comment
 - 
	
	
	
		
	
	
		
		
		
		
		
		
		
	
	
S0mthing else so how do u intend me to apply the code n0W? I tried the fell0wing but was n0t w0rking...andCode:RewriteRule^.*$userinfo.php? user=$1[L] RewriteRule ^([a-zA-Z0-9_\-\.\/]+)$ userinfo.php?user=$1 [L] RewriteRule ^([a-zA-Z0-9-\_\.\/]+)/$ userinfo.php?user=$1 [L]
andCode:RewriteRule^.*$userinfo.php? user=$1[L] RewriteRule ^([a-zA-Z0-9_-]+)$ userinfo.php?user=$1 [L] RewriteRule ^([a-zA-Z0-9-_]+)/$ userinfo.php?user=$1 [L]
Code:RewriteRule ^([a-zA-Z0-9_\-\.\/]+)$ userinfo.php?user=$1 [L] RewriteRule ^([a-zA-Z0-9-\_\.\/]+)/$ userinfo.php?user=$1 [L]
Comment
 - 
	
	
	
		
	
	
		
		
		
		
		
		
		
	
	
Try adding a second directory into the rule (this will save you having to rewrite for every file/directory) eg:
yoursite.con/directory/yourName
also make sure you don't add the original 2 rules as they will trash this rule >.<PHP Code:RewriteRule ^ /directory/.*$ userinfo.php?user=$1[L]
I know its not exactly as you want it but it will save your site from running slow from following to many rules, the only other option is to do a string replacement on the symbol "/" in your php script to replace it with something else to get round the forward slash problem
							
						
Comment
 - 
	
	
	
		
	
	
		
		
		
		
		
		
		
	
	
Did you change the links in page?Originally posted by Junkle View Posti did that but i got an eror..Code:RewriteRule ^([a-zA-Z0-9_-\.]+)$ userinfo.php?user=$1 [L] RewriteRule ^([a-zA-Z0-9_-\.]+)/$ userinfo.php?user=$1 [L]
that 0ne affect all my page saying user n0t found. Even with this bel0wCode:RewriteRule ^([a-zA-Z0-9_\-\.]+)$ userinfo.php?user=$1 [L] RewriteRule ^([a-zA-Z0-9_\-\.]+)/$ userinfo.php?user=$1 [L]
andCode:RewriteRule ^([a-zA-Z0-9-.]+)$ userinfo.php?user=$1 [L] RewriteRule ^([a-zA-Z0-9-.]+)/$ userinfo.php?user=$1 [L]
Code:RewriteRule ^([a-zA-Z0-9_.]+)$ userinfo.php?user=$1 [L] RewriteRule ^([a-zA-Z0-9_.]+)/$ userinfo.php?user=$1 [L]
<!DOCTYPE html PUBLIC "-//WAPFORUM.RS
Comment
 - 
	
	
	
		
	
	
		
		
		
		
		
		
		
	
	
Dude Use this one
Use this code for it in your .htaccess of home directoryCode:RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]*)/$ /user.php?username=$1 [L]
this will first check for if any folder with name exist there / any url exist
e.g.
yoursite.com/contact_us
this is not user so if any directory exist it will give it more priority, else it will proceed to your user page.
Comment
 - 
	
	
	
		
	
	
		
		
		
		
		
		
		
	
	
thanx man. I used your idea to do s0mething like thisOriginally posted by funtowap View PostDude Use this one
Use this code for it in your .htaccess of home directoryCode:RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]*)/$ /user.php?username=$1 [L]
this will first check for if any folder with name exist there / any url exist
e.g.
yoursite.com/contact_us
this is not user so if any directory exist it will give it more priority, else it will proceed to your user page.and its works as i wanted. But its still treating f0lders in my home directory as username whereby telling me, username n0t f0und. But only works for three f0lders and i observed that those three folderz are f0lderz that c0ntain .htaccess file in it. What could be the issue here...Code:RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]*)$ userinfo.php?user=$1 [L] RewriteRule ^([^/]*)/$ userinfo.php?user=$1 [L]
Comment
 - 
	
	
	
		
	
	
		
		
		
		
		
		
		
	
	
Sorry? i didnt get your problem this time :DOriginally posted by Junkle View Postthanx man. I used your idea to do s0mething like thisand its works as i wanted. But its still treating f0lders in my home directory as username whereby telling me, username n0t f0und. But only works for three f0lders and i observed that those three folderz are f0lderz that c0ntain .htaccess file in it. What could be the issue here...Code:RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^/]*)$ userinfo.php?user=$1 [L] RewriteRule ^([^/]*)/$ userinfo.php?user=$1 [L]
Comment
 
Comment