Forum Moderators: phranque

Message Too Old, No Replies

Querystrings not passing

         

asantos

11:51 pm on Dec 12, 2008 (gmt 0)

10+ Year Member



Hi, i have this solution for smartlinks (it works great). But i have a small doubt.

1. This is how i call the user info:
RewriteRule ^users/([A-Za-z0-9_-]+)/?$ /data.php?user=$1 [NC,L][b]

2. I go to:
[b]http://domain.com/users/asantos?msg=5

3. I only receive this data:
$_GET['user'] = 'asantos'
$_GET['msg'] =

Im not getting the value for "msg". Why?

g1smd

12:03 am on Dec 13, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



You need a
 RewriteCond
to test the
 {QUERY_STRING} 
to extract that value, and then pass it over in
%1
(that's %1 with a % sign).

If you are using

[NC]
then you don't need both
A-Z
and
a-z
to be specified; the
[NC]
means "use any case".

Don't make the trailing slash on the URL as optional. That would mean that two different URLs would be able to access the same content. Don't create your own Duplicate Content problem here.

Before this rewrite, you also need to add a 301 redirect from non-www to www in order to suppress yet another potential Duplicate Content issue.

jdMorgan

12:29 am on Dec 13, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Add the Query String Append [QSA] flag:

RewriteRule ^users/([A-Za-z0-9_-]+)/?$ /data.php?user=$1 [[b]QSA[/b],L]

Remove the [NC] flag unless you want to accept requests for "example.com/UsErS/asantos" and the like.

Jim

asantos

8:26 pm on Dec 15, 2008 (gmt 0)

10+ Year Member



worked great! thanks.

since this will be returning an xml file, i will remove the [NC] flag.

for the website, i think is better to leave it, because someone can type:
www.domain.com/ABOUT
or
www.domain.com/about

what do you think?

g1smd

8:52 pm on Dec 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



If they get the case wrong, you must redirect to the correct case or serve a 404.

Failure to do that will serve Duplicate Content.

jdMorgan

9:15 pm on Dec 15, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



In fact, it would create 32 identical pages at different URLs, just for your "about page." So, you might expect the page to rank 32 times further from the top of the rankings in search, and to pass 1/32nd of the page rank it could pass to other pages.

One page should be accessible at one and only one URL. As gismd says, any change at all to the URL should result in either a 301 redirect to the correct URL, or a 404 Not Found response. HTTP vs. HTTPS, www.example.com vs. example.com, uppercase vs. lowercase vs. mixed-cased -- all of these and more are different URLs.

Jim

asantos

10:32 pm on Dec 16, 2008 (gmt 0)

10+ Year Member



ok, im gonna stop using NC from now on hehe. Just one final question:

domain.com/about/
and
domain.com/about (without slash at the end)

which one is "better" ?

jdMorgan

6:56 pm on Dec 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If "about" is a page in your top-level directory, then it should not have a trailing slash. If it is a directory index (file listing) or an index page in the /about/ subdirectory, then it should have a slash.

Jim

asantos

6:46 pm on Dec 18, 2008 (gmt 0)

10+ Year Member



what do you mean with an "index page in the /about/ subdirectory" ?

By following your recommendation, i guess this is whats right:
[domain.com...]
[domain.com...]
[domain.com...]

[domain.com...]
(where this is like seeing a FTP file list)

g1smd

6:59 pm on Dec 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Yes, that seems right.

asantos

7:06 pm on Dec 18, 2008 (gmt 0)

10+ Year Member



ok thanks!