Forum Moderators: phranque

Message Too Old, No Replies

mod rewrite help?

         

dmoontown5

12:37 pm on Jul 10, 2008 (gmt 0)

10+ Year Member



http://example.com/member.php?username=aaaa

http://www.example.com/aaaa or [site.com...]
will be redirected to or equivalent to :
http://example.com/member.php?username=aaaa

so far this is what I have, it does not work

rewriteEngine on
Options +FollowSymlinks
rewriteCond %{REQUEST_FILENAME} !-d
rewriteRule ^([^/]+)/$ /member.php?username=$1 [L]

Thanks in advance

[edited by: jdMorgan at 2:40 pm (utc) on July 10, 2008]
[edit reason] example.com [/edit]

jdMorgan

2:43 pm on Jul 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You will also need to check for "file exists".

You RewriteRule requires a trailing slash on the requested URL-path. Your example URLs do not include a trailing slash.

You should redirect example.com to www.example.com, or redirect www.example.com to example.com, so that only one of these hostnames will be listed by search engines. Otherwise, search engines will see two identical sites, competing with each other for ranking, and this is not good.

Jim

dmoontown5

7:17 pm on Jul 10, 2008 (gmt 0)

10+ Year Member



I removed the backslash and added file exist -f
but this still does not work?

rewriteEngine on
Options +FollowSymlinks
rewriteCond %{REQUEST_FILENAME} !-f
rewriteRule ^([^/]+)$ /member.php?username=$1 [L]

McBlack

6:57 pm on Jul 11, 2008 (gmt 0)

10+ Year Member



Try this

RewriteEngine on
Options +FollowSymlinks
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ /member.php?username=$1 [L]