1

I want to change some rules in .htaccess file write now my url is like this www.example.com/d/somthing.htm and some another pages with www.example.com/category.htm now i want to change them in this way www.example.com/index.php?d=somthing what i have to do.

My current .htaccess content are:-

 <IfModule mod_rewrite.c>
    Options +FollowSymLinks
    RewriteEngine On
    RewriteBase /

    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteCond %{REQUEST_URI} ^/p\/[a-z][a-z]\/[[:print:]]+\.htm$
    #RewriteRule \/p\/([a-z][a-z])\/([[:print:]]+)\.htm$ /index.php?p=$2&lang=$1 [L]
    #RewriteRule \/p\/([a-z][a-z])\/([[:print:]]+)\.htm$ /index.php?p=$2&lang=$1 [L]

    RewriteRule . /index.php [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/p\/[[:print:]]+\.htm$
    RewriteRule \/p\/([[:print:]]+)\.htm$ /index.php?p=$1 [L]



    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/s\/[a-z][a-z]\/[0-9]+\/.*$
    RewriteRule \/s\/([a-z][a-z])\/([0-9]+)\/.*$ /category.php?action=something&value=$2&lang=$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/s\/[0-9]+\/.*$
    RewriteRule \/s\/([0-9]+)\/.*$ /category.php?action=something&value=$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/n\/[a-z][a-z]\/[0-9]+\/.*$
    RewriteRule \/n\/([a-z][a-z])\/([0-9]+)\/.*$ /novel.php?action=more&value=$2&lang=$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^\/n\/[0-9]+\/.*$
    RewriteRule \/n\/([0-9]+)\/.*$ /novel.php?action=more&value=$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^\/sn\/[0-9]+\/.*$
    RewriteRule \/sn\/([0-9]+)\/.*$ /novel.php?action=all&type=$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^\/[a-z][a-z]\/[0-9]+\/.*$
    RewriteRule \/([a-z][a-z])\/([0-9]+)\/.*$ /category.php?action=product&product=$2&lang=$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^\/[0-9]+\/.*$
    RewriteRule \/([0-9]+)\/.*$ /category.php?action=product&product=$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^\/img\/[0-9]+\/[0-9]+\/.*$
    RewriteRule \/img\/([0-9]+)\/([0-9]+)\/.*$ /img.php?value=$1-$2 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/[0-9]+\+[a-z][a-z]\+[0-9]+\+.*$
    RewriteRule /([0-9]+)\+([a-z][a-z])\+([0-9]+)\+.*$ /category.php?action=product&product=$1&lang=$2&something=$3 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/[0-9]+\+[a-z][a-z]\+.*$
    RewriteRule /([0-9]+)\+([a-z][a-z])\+.*$ /category.php?action=product&product=$1&lang=$2 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/[0-9]+\+\+.*$
    RewriteRule /([0-9]+)\+\+.*$ /category.php?action=product&product=$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^\/img\/[0-9]+\/[0-9]+\/.*$
    RewriteRule \/img\/([0-9]+)\/([0-9]+)\/.*$ /img.php?value=$1-$2 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/[0-9]+\+[a-z][a-z]\+[0-9]+\+.*$
    RewriteRule /([0-9]+)\+([a-z][a-z])\+([0-9]+)\+.*$ /category.php?action=product&product=$1&lang=$2&something=$3 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/[0-9]+\+[a-z][a-z]\+.*$
    RewriteRule /([0-9]+)\+([a-z][a-z])\+.*$ /category.php?action=product&product=$1&lang=$2 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/[0-9]+\+\+.*$
    RewriteRule /([0-9]+)\+\+.*$ /category.php?action=product&product=$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/[0-9]+$
    RewriteRule /([0-9]+)$ /category.php?action=product&product=$1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_URI} ^/s[0-9]+\+[a-z][a-z]\+.*$
    RewriteRule /s([0-9]+)\+([a-z][a-z])\+.*$ /category.php?action=something&value=$1&lang=$2 [L]



</IfModule>
2

1 Answer 1

2

You can use these 2 rules in your root .htaccess:

DirectoryIndex index.php

RewriteEngine On

RewriteRule ^(?:d/)?(.+?)\.html?$ index.php?d=$1 [L,QSA,NC,R]
Sign up to request clarification or add additional context in comments.

2 Comments

please now look the htaccess file code other code is dependent on those four line so now how can i change it. in this code i want everything remain same just want links in the way as i describe in the question.
finally it works actually i have not change my local DNS thats why changes was not reflecting thank you so much.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.