how to remove .HTML extension from url in OxyClassifieds

Discussion in 'HTML & Website Design' started by hackdack, May 31, 2015.

  1. #1
    Hi :)

    can you help to explain how to remove .HTML extension from url in OxyClassifieds such as listings.html , details.html and index.html in URLs

    i have to Edit .htaccess file only or i have to do something else in another files ?

    1- example : http://www.domain.com/2-real-estate/index.HTML
    1- to be like: http://www.domain.com/2-real-estate

    .htaccess attached if needed

    thanks
     

    Attached Files:

    hackdack, May 31, 2015 IP
  2. Doctor Tech

    Doctor Tech Member

    Messages:
    60
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    45
    #2
    Try adding this to your .htaccess:

    RewriteEngine on
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME}\.html -f
    RewriteRule ^(.*)$ $1.html
     
    Doctor Tech, May 31, 2015 IP
  3. hackdack

    hackdack Member

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #3
    Doctor Tech

    Thanks for your help , but the URL still the same with your code.

    #
    #   
    # OxyClassifieds.com : PHP Classifieds (http://www.oxyclassifieds.com)
    # version 8
    # (c) 2014 OxyClassifieds.com (office@oxyclassifieds.com).
    #
    #
               
    <IfModule mod_deflate.c>
    # DEFLATE by type - html, text, css, xml
    AddOutputFilterByType DEFLATE text/html text/plain text/css text/xml
    
    # DEFLATE by type - javascript
    AddOutputFilterByType DEFLATE application/x-javascript application/javascript text/javascript text/x-js text/x-javascript
    
    # DEFLATE by extension
    AddOutputFilter DEFLATE js css htm html xml
    </IfModule>
    
    
    ## Uncomment this if FollowSymLinks is not already enabled on your server
    #Options +FollowSymLinks
    
    ## Use mod rewrite
    ## Comment the line below if RewriteEngine not already enabled on your server
    RewriteEngine On
    
    ## Uncomment the line below and change the path if your script is installed
    ## in a different path than the root folder of your domain
    
    #RewriteBase /
    
    RewriteRule ^index.html index.php [nc]
    RewriteRule ^recent_ads.html recent_ads.php [nc]
    RewriteRule ^register.html register.php [nc]
    RewriteRule ^pre-register.html pre-register.php [nc]
    RewriteRule ^login.html login.php [nc]
    RewriteRule ^logout.html logout.php [nc]
    RewriteRule ^favorites.html favorites.php [nc]
    RewriteRule ^contact.html contact.php [nc]
    RewriteRule ^listings.html listings.php [nc]
    RewriteRule ^pre-submit.html pre-submit.php [nc]
    RewriteRule ^refine.html refine.php [nc]
    RewriteRule ^([0-9]+)-([^\/]+)?/content.html$ content.php?id=$1 [nc,qsa]
    RewriteRule ^([0-9]+)-([^\/]+)?/index.html$ index.php?category=$1 [nc,qsa]
    RewriteRule ^([0-9]+)-([^\/]+)?/details.html$ details.php?id=$1 [nc,qsa]
    RewriteRule ^([^\/]+)/([^\/]+)/([^\/]+)/recent_ads.html$ recent_ads.php?page=$1&order=$2&order_way=$3 [nc,qsa]
    RewriteRule ^([^\/]+)/recent_ads.html$ recent_ads.php?page=$1 [nc,qsa]
    RewriteRule ^([0-9]+)-([^\/]+)?/user_listings.html$ user_listings.php?id=$1 [nc,qsa]
    RewriteRule ^([0-9]+)-([^\/]+)?/contact_details.html$ contact_details.php?id=$1 [nc,qsa]
    RewriteRule ^([0-9]+)-([^\/]+)?/([^\/]+)/([^\/]+)/([^\/]+)/user_listings.html$ user_listings.php?id=$1&page=$3&order=$4&order_way=$5 [nc,qsa]
    RewriteRule ^([0-9]+)-([^\/]+)/([^\/]+)/user_listings.html$ user_listings.php?id=$1&page=$3 [nc,qsa]
    RewriteRule ^([^\/]+)/([^\/]+)/([^\/]+)/favorites.html$ favorites.php?page=$1&order=$2&order_way=$3 [nc,qsa]
    RewriteRule ^([0-9]+)-([^\/]+)?/store.html$ store.php?id=$1 [nc,qsa]
    RewriteRule ^([0-9]+)-([^\/]+)?/([^\/]+)/([^\/]+)/([^\/]+)/store.html$ store.php?id=$1&page=$3&order=$4&order_way=$5 [nc,qsa]
    RewriteRule ^([0-9]+)-([^\/]+)/([^\/]+)/store.html$ store.php?id=$1&page=$3 [nc,qsa]
    
    
    #affiliate link
    RewriteCond %{REQUEST_URI} ^(.*)/aff-([0-9]+)(.*)$ [NC]
    RewriteRule (.*) ./index.php?aff=%2
    
    # mobile subdomain
    RewriteCond %{HTTP_HOST} ^m\.(.*)$ [NC]
    RewriteRule (.*) %{SCRIPT_FILENAME}?mobile=1 [NC,QSA]
    
    
    ## Uncomment the following line when activating location subdomains
    ## Don't forget to replace yourdomainname.com with your own domain name !
    
    RewriteCond %{HTTP_HOST} !www.yourdomainname.com$ [NC]
    RewriteCond %{HTTP_HOST} ^(www.)?([a-z0-9-_]+).yourdomainname.com [NC]
    RewriteRule (.*) %{SCRIPT_FILENAME}?crt_city=%2 [NC,QSA]
    
    RewriteCond %{REQUEST_URI} ^(.*)(/listings.html)(.*)$ [NC]
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteRule (.*) ./listings.php?$1
    
    # error page
    # if your script is installed in a subfolder then correct the path below by adding the
    # subfolder in the following way: /subfolder/notfound.php
    ErrorDocument 404 /notfound.php
    
    # redirect links accesses without www towards the ones with www
    #RewriteCond %{HTTP_HOST} !^www\.
    #RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
    Code (markup):
     
    hackdack, May 31, 2015 IP
  4. hackdack

    hackdack Member

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    36
    #4
    Up
     
    hackdack, Nov 13, 2015 IP