1 Vote Vote

Strange characters in url - simple link and mod_rewrite

Posted by topdog 299 days ago Questions| menu php video All

Please see: http://test.shivimpanim.org

Click on any of Video, Action, Games, or Tools

Notice how strange characters get appended to the end of the url! Why is that?

Sniffing in Charles give me no indication of a secondary redirect...

Here is my .htaccess:

# Set up mod_rewrite
Options +FollowSymLinks
RewriteEngine on
#
# Rules follow

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ $1 [R,L]

# Here we simply remap the name if it doesn't exist as a file or directory
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d

RewriteRule ^video$ /index.php?s=video [NC,L]
RewriteRule ^action$ /index.php?s=action [NC,L]
RewriteRule ^games$ /index.php?s=games [NC,L]
RewriteRule ^tools$ /index.php?s=tools [NC,L]
RewriteRule ^jplay$ /index.php?s=jplay [NC,L]
RewriteRule ^contact$ /index.php?s=contact [NC,L]

RewriteRule ^video/(.*) /index.php?s=video&p=$1 [NC,L]
RewriteRule ^action/(.*) /index.php?s=action&p=$1 [NC,L]
RewriteRule ^games/(.*) /index.php?s=games&p=$1 [NC,L]
RewriteRule ^tools/(.*) /index.php?s=tools&p=$1 [NC,L]
RewriteRule ^jplay/(.*) /index.php?s=jplay&p=$1 [NC,L]
RewriteRule ^contact/(.*) /index.php?s=contact&p=$1 [NC,L]

Here is my index.php:

<?php
$pageurl = $_REQUEST['p'];
$section = $_REQUEST['s'];

include_once('main_top.php');

echo($section);

include_once('main_bottom.php');

?>

Here is my main_top.php:

<?php 
    $top_menu_home = 'top_menu_home';
    $top_menu_store = 'top_menu_store';
    $top_menu_video = 'top_menu_video';
    $top_menu_action = 'top_menu_action';
    $top_menu_games = 'top_menu_games';
    $top_menu_tools = 'top_menu_tools';
    $top_menu_articles = 'top_menu_articles';
    $top_menu_jplay = 'top_menu_jplay';
    $top_menu_contact = 'top_menu_contact';

    switch($section) {
        case 'store': $top_menu_store .= '_selected'; break;
        case 'video': $top_menu_video .= '_selected'; break;
        case 'action': $top_menu_action .= '_selected'; break;
        case 'games': $top_menu_games .= '_selected'; break;
        case 'tools': $top_menu_tools .= '_selected'; break;
        case 'articles': $top_menu_articles .= '_selected'; break;
        case 'jplay':   $top_menu_jplay .= '_selected'; break;
        case 'contact': $top_menu_contact .= '_selected'; break;
        default: $top_menu_home .= '_selected'; break;
    }
?>

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title></title>
        <link TYPE="text/css" rel="stylesheet" href="css/common.css" media="all"/>
        <link TYPE="text/css" rel="stylesheet" href="css/video.css" media="all"/>
        <link TYPE="text/css" rel="stylesheet" href="css/flexcroll.css" media="all"/>

        <script type='text/javascript' src="js/flexcroll.js"></script>
        <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
        <script type="text/javascript">
            var addthis_config = {
                data_track_clickback:true,
                data_track_addressbar:true,
                services_compact: "twitter, email, facebook, google, stumbleupon, digg, more",
                services_exclude: "print",
                ui_offset_left: -300
            };
        </script>
        <script type="text/javascript" src="http://s7.addthis.com/js/250/addthis_widget.js#pubid=ra-4e07777b3143e5fb"></script>
    </head>
    <body>
        <ul id="top_menu">
            <a href="/"><li id="<?php echo($top_menu_home); ?>"><span>Home</span></li></a>
            <a href="/store"><li id="<?php echo($top_menu_store); ?>"><span>Store</span></li></a>
            <a href="/video"><li id="<?php echo($top_menu_video); ?>"><span>Video</span></li></a>
            <a href="/action"><li id="<?php echo($top_menu_action); ?>"><span>Action</span></li></a>
            <a href="/games"><li id="<?php echo($top_menu_games); ?>"><span>Games</span></li></a>
            <a href="/tools"><li id="<?php echo($top_menu_tools); ?>"><span>Tools</span></li></a>
            <a href="/articles"><li id="<?php echo($top_menu_articles); ?>"><span>Articles</span></li></a>
            <a href="/jplay"><li id="<?php echo($top_menu_jplay); ?>"><span>jPlay</span></li></a>
            <a href="/contact"><li id="<?php echo($top_menu_contact); ?>"><span>Contact</span></li></a>

            <form id="searchform" name="searchform" action="search.php">
                <img id="searchglass" src="menu/SEARCHGLASS.png" onclick="searchform.submit();"/>
                <input type="text" name="query" id="query" value="" />
            </form>
        </ul>

        <div class="clearfloat">&nbsp;</div>

        <div id="submenu">

            <div id="breadcrumbs" class="breadcrumbs_link">
                <a href="#">VIDEO</a> > <a href="#">QUESTIONS & ANSWERS</a>
            </div>

            <div class="clearfloat"></div>

            <div id="social">
                <!-- AddThis Button BEGIN -->
                <div class="addthis_toolbox addthis_default_style ">
                    <a class="addthis_counter addthis_pill_style"></a>
                </div>

                <!-- PlusOne Button BEGIN -->
                <div id="gp-container">
                    <g:plusone size="small"></g:plusone>
                </div>

                <!-- Facebook Button BEGIN -->
                <iframe src="http://www.facebook.com/plugins/like.php?app_id=147083741996431&amp;href&amp;send=false&amp;layout=button_count&amp;width=90&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=verdana&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:90px; height:21px;" allowTransparency="true"></iframe>
            </div>
        </div>

        <div class="clearfloat">&nbsp;</div>
        <br/>&nbsp;<br/>

And here is main_bottom.php

</body>
</html>

Originally asked by: davidkomer on Stack Overflow

Discuss Bury


Who Voted for this Question