Forum for discussing general topics related to Couch.
4 posts Page 1 of 1
Hi

I'm stuck with url issue. After change my site into multilang site(en to ar), whenever i click static page menu(not in couch) ,it gives 404 error. But i click couch templete files its working perfectly.idk the exact reason and solution. Pls someone help me out from this as soon as possible.

My navbar.php
Code: Select all
<?php
include_once 'include/dbconnect.php';
   include_once('include/common_functions.php');

$conn = mysqli_connect(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME);

$nav_query = "SELECT value from couch_data_text WHERE page_id=499 and ( field_id=179 or field_id=180 or field_id=181 )";

$nav_data= mysqli_fetch_all(mysqli_query($conn, $nav_query));
?>

<!-- Google Tag Manager (noscript) -->
<!--noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NLWDB99" height="0" width="0"
            style="display:none;visibility:hidden"></iframe></noscript-->
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-T3CNZWP"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->

    <!-- End Google Tag Manager (noscript) -->
<!-- menu -->

<style>
     h1,h2,h3,h4,h5,h6,li,p {
            font-family: 'Maven Pro';
        }
       
        .topbar h5 {
            font-family: 'Maven Pro';
        }
       
    .dropdown-menu li a {
            font-weight: 500;
        }
       
</style>

<header>
<?php
if(isset($language) && !empty($language) && $language=='en')
{
     $language = 'en';
}
else
{
     $language = 'ar';
}
?>

<div class="topbar" id="topbar">
    <h5><?= $nav_data[1][0] ?><button class="get_quote_btn"><a class="" href="<?= $nav_data[2][0] ?>"><?= $nav_data[0][0] ?></a></button></h5>
</div>

<div class="MainMenu">

    <nav class="navbar navbar-expand-lg navbar-light">

        <div class="logo mr-sm-auto">
           
            <a href="/index.php"><img src="/images/Home/logo1.webp" alt="csw-logo" class="img-fluid" /></a>

        </div>

        <button class="navbar-toggler collapsed" type="button" data-toggle="collapse" data-target="#navbar"
            aria-controls="navbar" aria-expanded="false" aria-label="Toggle navigation">

            <span class="navbar-toggler-icon"></span>

        </button>

        <div class="collapse navbar-collapse" id="navbar">

            <ul class="navbar-nav ml-auto d-none d-sm-flex">

                <li class="nav-item dropdown">

                    <a class="nav-link dropdown-toggle" href="/<?php echo $language ?>/services" onclick="location.href='/<?php echo $language ?>/services'" id="navbar-services" data-toggle="dropdown"
                        aria-haspopup="true" aria-expanded="false">

                        <?php echo $lang['Services'] ?>

                    </a>

                    <ul class="dropdown-menu" aria-labelledby="navbar-services">


                        <li>

                            <a class="dropdown-item" href="/<?php echo $language ?>/services/vulnerability-management-as-a-service"><?php echo $lang['Vulnerability Management as a Service (VMaaS)'] ?></a>

                        </li>

                        <li>

                            <a class="dropdown-item" href="/<?php echo $language ?>/services/pentesting-service"><?php echo $lang['Penetration Testing as a Service'] ?></a>

                        </li>
                       
                        <li>

                            <a class="dropdown-item" href="/<?php echo $language ?>/services/pci-asv"><?php echo $lang['PCI Compliance'] ?></a>

                        </li>
                       
                        <li class="dropdown-submenu">

                            <a class="dropdown-item dropdown-toggle" href="/<?php echo $language ?>/services/aws-cloud-security" onclick="location.href='/<?php echo $language ?>/services/aws-cloud-security'" id="navbar-pts" data-toggle="dropdown" aria-haspopup="false" aria-expanded="false"><?php echo $lang['AWS Cloud Security'] ?></a>
                       
                            <ul class="navbar_diff_bg" aria-labelledby="navbar-pts">

                                <a class="dropdown-item bg_none_hover"
                                    href="/<?php echo $language ?>/services/aws-security-as-a-service"><?php echo $lang['AWS Security as a Service'] ?></a>
                            </ul>
                            <ul class="navbar_diff_bg" aria-labelledby="navbar-pts">

                                <a class="dropdown-item bg_none_hover"
                                    href="/<?php echo $language ?>/services/aws-security-assessment"><?php echo $lang['AWS Security Assessment'] ?></a>
                            </ul>
                       
                        </li>
                       
                       
                     
               
                <li class="nav-item dropdown">

                    <a class="nav-link dropdown-toggle" href="/<?php echo $language ?>/about-us" onclick="location.href='/<?php echo $language ?>/about-us'" id="navbar-services" data-toggle="dropdown"
                        aria-haspopup="true" aria-expanded="false">

                        <?php echo $lang['About Us'] ?>

                    </a>

                    <ul class="dropdown-menu" aria-labelledby="navbar-services">


                        <li>
                            <a class="dropdown-item" id="pills-home" href="/<?php echo $language ?>/leaders"><?php echo $lang['Leadership'] ?></a>

                        </li>
                   
                    </ul>

                </li>


                <ul>
                    <?php
                      if(isset($language) && $language == 'en')
                      {
                    ?>
                    <a href="<cms:show k_link_ar />"><button class="get_quote_btn">عربى</button></a>
                <?php } else { ?>
                    <a href="<cms:show k_link_en />"><button class="get_quote_btn">English</button></a>
                <?php } ?>
               
               
            </ul>
           

           
        </div>

    </nav>

</div>

</header>
<!-- endof menu  -->

My common_function.php
Code: Select all
<?php
$url = $_SERVER["REQUEST_URI"];
$begnString="/ar/";
$len = strlen($begnString);
if (substr($url, 0, $len) === $begnString){
    $language = "ar";
}else {
    $language = "en";
}

$url = $_SERVER["REQUEST_URI"];
$begnString="/ar/";
$len = strlen($begnString);
if (substr($url, 0, $len) === $begnString){
    $_SESSION['lang'] = "arabic";
}
else{
    $_SESSION['lang'] = "english";
}

require_once($_SESSION['lang'] . ".php");


In my navbar.php file => when click services and services dropdown menu (php file not from couch ),it gives 404 error.But click about us dropdown (files from couch),its working correctly.

Attachments

Code: Select all
<cms:show 'Please don\'t be lazy and wrap code in bbcode!' />

Respect the people you ask for help :)
@divyamsd, the URLs you posted (e.g. http://mydomain.com/en/about-us/) suggest your site has prettyURLs activated.
Such URLS require proper entry in the .htaccess file present in your site's root.

For Couch managed templates, these entries are generated automatically (when you use gen_htaccess.php utility).
For templates that are not managed by Couch, you'll have to put in the required rules yourself.
I suspect you have failed to do just that with the problematic 'services' template.

You may take a look at the generated .htaccess file and try and modify the rules placed by Couch for 'about-us' template to make it suitable for the template in question.

Hope this helps.
Hi @KK, I changed my .htaccess file. But it gives 404 error page.


.htaccess file
Code: Select all
#glossary.php  (managed by couch template)
RewriteRule ^(?:en|ar)/glossary$ "$0/" [R=301,L,QSA]
RewriteRule ^(en|ar)/glossary/$ glossary.php?lc=$1 [L,QSA]
RewriteRule ^(en|ar)/glossary/.*?([^\.\/]*)\.html$ glossary.php?pname=$2&lc=$1 [L,QSA]
RewriteRule ^(en|ar)/glossary/([1-2]\d{3})/(?:(0[1-9]|1[0-2])/(?:(0[1-9]|1[0-9]|2[0-9]|3[0-1])/)?)?$ glossary.php?d=$2$3$4&lc=$1 [L,QSA]
RewriteRule ^(en|ar)/glossary/[^\.]*?([^/\.]*)/$ glossary.php?fname=$2&lc=$1 [L,QSA]
RewriteRule ^(?:en|ar)/glossary/[^\.]*?([^/\.]*)$ "$0/" [R=301,L,QSA]


#get-quote.php (not managed by couch template)
RewriteRule ^(?:en|ar)/get-quote$ "$0/" [R=301,L,QSA]
RewriteRule ^(en|ar)/get-quote/$ get-quote.php?lc=$1 [L,QSA]
RewriteRule ^(en|ar)/get-quote/.*?([^\.\/]*)\.html$ get-quote.php?pname=$2&lc=$1 [L,QSA]
RewriteRule ^(en|ar)/get-quote/([1-2]\d{3})/(?:(0[1-9]|1[0-2])/(?:(0[1-9]|1[0-9]|2[0-9]|3[0-1])/)?)?$ get-quote.php?d=$2$3$4&lc=$1 [L,QSA]
RewriteRule ^(en|ar)/get-quote/[^\.]*?([^/\.]*)/$ get-quote.php?fname=$2&lc=$1 [L,QSA]
RewriteRule ^(?:en|ar)/get-quote/[^\.]*?([^/\.]*)$ "$0/" [R=301,L,QSA]

Glossary page working perfectly but get-quote page not working(404 error)
glossary page url : http://mydomain.com/en/glossary (working)
get-quote page url : http://mydomain.com/en/get-quote (404 error)

when i change my url as http://mydomain.com/get-quote.php. for get-quote menu it's working.
Why does this url (http://mydomain.com/en/get-quote) give 404 error?
Thank you,
4 posts Page 1 of 1
cron