how to remove .php extension using htaccess on godaddy linux hosting Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern) Come Celebrate our 10 Year Anniversary!Enable php extension within .htaccessHow to 301 redirect a single file or directory on a GoDaddy shared Windows hosting plan?.htaccess mod_rewrite remove .php extension, but preserve URL pathmod_rewrite remove trailing slash is causing loopsHtaccess regex working strange.htaccess redirect all extension to phprewrite rule does not rewrite url as expectedGodaddy .htaccess and mod_urlhtaccess: Remove PHP extension only for specific files or folder.htaccess remove php file extension not working only on heroku

What does the black goddess statue do and what is it?

Why is arima in R one time step off?

Marquee sign letters

/bin/ls sorts differently than just ls

Protagonist's race is hidden - should I reveal it?

`FindRoot [ ]`::jsing: Encountered a singular Jacobian at a point...WHY

Why did Europeans not widely domesticate foxes?

Processing ADC conversion result: DMA vs Processor Registers

Is it appropriate to mention a relatable company blog post when you're asked about the company?

RIP Packet Format

Did war bonds have better investment alternatives during WWII?

Why do people think Winterfell crypts is the safest place for women, children & old people?

Are these square matrices always diagonalisable?

Is there an efficient way for synchronising audio events real-time with LEDs using an MCU?

Will I be more secure with my own router behind my ISP's router?

What to do with someone that cheated their way though university and a PhD program?

What is ls Largest Number Formed by only moving two sticks in 508?

Are there existing rules/lore for MTG planeswalkers?

How can I wire a 9-position switch so that each position turns on one more LED than the one before?

Does using the Inspiration rules for character defects encourage My Guy Syndrome?

Does Prince Arnaud cause someone holding the Princess to lose?

How would it unbalance gameplay to rule that Weapon Master allows for picking a fighting style?

Coin Game with infinite paradox

Why is water being consumed when my shutoff valve is closed?



how to remove .php extension using htaccess on godaddy linux hosting



Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30 pm US/Eastern)
Come Celebrate our 10 Year Anniversary!Enable php extension within .htaccessHow to 301 redirect a single file or directory on a GoDaddy shared Windows hosting plan?.htaccess mod_rewrite remove .php extension, but preserve URL pathmod_rewrite remove trailing slash is causing loopsHtaccess regex working strange.htaccess redirect all extension to phprewrite rule does not rewrite url as expectedGodaddy .htaccess and mod_urlhtaccess: Remove PHP extension only for specific files or folder.htaccess remove php file extension not working only on heroku



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








2















How to remove .php extension using .htaccess file. I have tried many examples without success. An Internal server error is regularly showing. I am using Godaddy Linux Hosting.



This code is the latest which I am using.



<IfModule mod_rewrite.c> 
Options All -Indexes
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

# Unless directory, remove trailing slash
RewriteCond %REQUEST_FILENAME !-d
RewriteRule ^([^/]+)/$ http://a.sprybirds.com/$1 [R=301,L]

# Redirect external .php requests to extensionless url
RewriteCond %THE_REQUEST ^(.+).php([#?][^ ]*)? HTTP/
RewriteRule ^(.+).php$ http://a.sprybirds.com/$1 [R=301,L]

# Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]
</IfModule>


Site is parked on a sub-domain http://subdomain.example.com and folder sequence is just like web-root/sub_folder/site_folder/.










share|improve this question
























  • What does your error log say? If it's throwing a 500 Internal, there's some kind of cause and the logfile should give you more detail about why that is.

    – ldennison
    Jun 28 '15 at 7:28











  • Can # occur in a request at all?

    – Hagen von Eitzen
    Jun 28 '15 at 13:48











  • if you are using godaddy, linux shared hosting, than try this article, it will get you the results.kvcodes.com/2016/02/godaddy-remove-php-extension

    – Kvvaradha
    Feb 17 '16 at 10:30

















2















How to remove .php extension using .htaccess file. I have tried many examples without success. An Internal server error is regularly showing. I am using Godaddy Linux Hosting.



This code is the latest which I am using.



<IfModule mod_rewrite.c> 
Options All -Indexes
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

# Unless directory, remove trailing slash
RewriteCond %REQUEST_FILENAME !-d
RewriteRule ^([^/]+)/$ http://a.sprybirds.com/$1 [R=301,L]

# Redirect external .php requests to extensionless url
RewriteCond %THE_REQUEST ^(.+).php([#?][^ ]*)? HTTP/
RewriteRule ^(.+).php$ http://a.sprybirds.com/$1 [R=301,L]

# Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]
</IfModule>


Site is parked on a sub-domain http://subdomain.example.com and folder sequence is just like web-root/sub_folder/site_folder/.










share|improve this question
























  • What does your error log say? If it's throwing a 500 Internal, there's some kind of cause and the logfile should give you more detail about why that is.

    – ldennison
    Jun 28 '15 at 7:28











  • Can # occur in a request at all?

    – Hagen von Eitzen
    Jun 28 '15 at 13:48











  • if you are using godaddy, linux shared hosting, than try this article, it will get you the results.kvcodes.com/2016/02/godaddy-remove-php-extension

    – Kvvaradha
    Feb 17 '16 at 10:30













2












2








2








How to remove .php extension using .htaccess file. I have tried many examples without success. An Internal server error is regularly showing. I am using Godaddy Linux Hosting.



This code is the latest which I am using.



<IfModule mod_rewrite.c> 
Options All -Indexes
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

# Unless directory, remove trailing slash
RewriteCond %REQUEST_FILENAME !-d
RewriteRule ^([^/]+)/$ http://a.sprybirds.com/$1 [R=301,L]

# Redirect external .php requests to extensionless url
RewriteCond %THE_REQUEST ^(.+).php([#?][^ ]*)? HTTP/
RewriteRule ^(.+).php$ http://a.sprybirds.com/$1 [R=301,L]

# Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]
</IfModule>


Site is parked on a sub-domain http://subdomain.example.com and folder sequence is just like web-root/sub_folder/site_folder/.










share|improve this question
















How to remove .php extension using .htaccess file. I have tried many examples without success. An Internal server error is regularly showing. I am using Godaddy Linux Hosting.



This code is the latest which I am using.



<IfModule mod_rewrite.c> 
Options All -Indexes
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /

# Unless directory, remove trailing slash
RewriteCond %REQUEST_FILENAME !-d
RewriteRule ^([^/]+)/$ http://a.sprybirds.com/$1 [R=301,L]

# Redirect external .php requests to extensionless url
RewriteCond %THE_REQUEST ^(.+).php([#?][^ ]*)? HTTP/
RewriteRule ^(.+).php$ http://a.sprybirds.com/$1 [R=301,L]

# Resolve .php file for extensionless php urls
RewriteRule ^([^/.]+)$ $1.php [L]
</IfModule>


Site is parked on a sub-domain http://subdomain.example.com and folder sequence is just like web-root/sub_folder/site_folder/.







linux php .htaccess apache-2.4 godaddy






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Oct 15 '18 at 14:24









MrWhite

6,43421426




6,43421426










asked Jun 28 '15 at 6:40









Kunwar Asif Ali KhanKunwar Asif Ali Khan

1113




1113












  • What does your error log say? If it's throwing a 500 Internal, there's some kind of cause and the logfile should give you more detail about why that is.

    – ldennison
    Jun 28 '15 at 7:28











  • Can # occur in a request at all?

    – Hagen von Eitzen
    Jun 28 '15 at 13:48











  • if you are using godaddy, linux shared hosting, than try this article, it will get you the results.kvcodes.com/2016/02/godaddy-remove-php-extension

    – Kvvaradha
    Feb 17 '16 at 10:30

















  • What does your error log say? If it's throwing a 500 Internal, there's some kind of cause and the logfile should give you more detail about why that is.

    – ldennison
    Jun 28 '15 at 7:28











  • Can # occur in a request at all?

    – Hagen von Eitzen
    Jun 28 '15 at 13:48











  • if you are using godaddy, linux shared hosting, than try this article, it will get you the results.kvcodes.com/2016/02/godaddy-remove-php-extension

    – Kvvaradha
    Feb 17 '16 at 10:30
















What does your error log say? If it's throwing a 500 Internal, there's some kind of cause and the logfile should give you more detail about why that is.

– ldennison
Jun 28 '15 at 7:28





What does your error log say? If it's throwing a 500 Internal, there's some kind of cause and the logfile should give you more detail about why that is.

– ldennison
Jun 28 '15 at 7:28













Can # occur in a request at all?

– Hagen von Eitzen
Jun 28 '15 at 13:48





Can # occur in a request at all?

– Hagen von Eitzen
Jun 28 '15 at 13:48













if you are using godaddy, linux shared hosting, than try this article, it will get you the results.kvcodes.com/2016/02/godaddy-remove-php-extension

– Kvvaradha
Feb 17 '16 at 10:30





if you are using godaddy, linux shared hosting, than try this article, it will get you the results.kvcodes.com/2016/02/godaddy-remove-php-extension

– Kvvaradha
Feb 17 '16 at 10:30










2 Answers
2






active

oldest

votes


















0














The question is missing example URLs, which is really essential for diagnosing such problems, however...




# Resolve .php file for extensionless php urls 
RewriteRule ^([^/.]+)$ $1.php [L]



This only matches URLs with single path segments, ie. URLs that are effectively in the document root, eg. /foo. It won't match URLs with multiple path segments, ie. URLs that are effectively in subdirectories eg. /foo/bar - which would explain why you are getting 404s for "php files inside the subfolder".



You need to remove the slash in the RewriteRule pattern, in order to match any URL depth:



RewriteRule ^([^.]+)$ $1.php [L]


By including a slash in the negated character class you are only matching URLs that don't contain a slash. ie. URLs in the document root only.



(There is no need to backslash escape a literal dot when used inside a character class.)






share|improve this answer






























    0














    Do you have a .htaccess file in ./public_html/? If so, what's inside it? The way .htaccess works is by giving the directory closest to the actual root top priority.



    As an example:



    /home/username/public_html/.htaccess


    is given a higher priority (i.e. more control) than



    /home/username/public_html/sub_directory/.htaccess


    If you're primary .htaccess file is setting rules one way and the sub-directory is setting them another, it's possible you'll run in to issues (i.e. an error).



    If you're set in your actual web root, the following lines could be causing some issues as cPanel allows server administrators to set these options by default from within WHM. If these are already set (specifically -Indexes), you'll likely see an error.



    Options All -Indexes
    Options +FollowSymLinks -MultiViews


    Note: The -Indexes directive is normally set by default before clients are even placed on a server (or it should be, unless there's a specific reason not to), FYI. This is more of a security recommendation to prevent directory browsing as not every client is going to know that unless there's an index.[ext] file in every directory, their directories are wide-open for browsing by whoever wants to take a look.




    If removing those resolves the error, then you've found the problem :). If removing these lines does not work, trial & error is where we need to start.



    Back to the top, look in directories that reside above the directory you're having issues with. Check the .htaccess files and make sure you have "display or show hidden files" checked or set to "yes" in the S/FTP program that you're using as they're not always visible by default.



    From here, the best course of action would be to backup each .htaccess file and re-add them one-by-one until you run in to another error. This way you can mark down which file upload brought on the error and we can take a look at that one.




    Update #01



    Since the culprit for the error most likely was indeed the -Indexes, you can add the following back to the .htaccess file:



    Options +FollowSymLinks -MultiViews


    If that does not resolve the 404, try this:



    Options +FollowSymLinks -MultiViews
    RewriteEngine On
    RewriteBase /

    # Adds Trailing Slash to the URI as long as it's not for a
    # file.
    RewriteCond %REQUEST_FILENAME !-f
    RewriteCond %REQUEST_URI !(.[a-zA-Z0-9]1,5|/|#(.*))$
    RewriteRule ^(.*)$ http://subdomain.example.com/$1/ [R=301,L]

    # Checks to make sure the request is a directory.
    # Checks to see if the request matches a file with a .php ext.
    # If all is well, push the request through to the matching file.
    RewriteCond %REQUEST_FILENAME !-d
    RewriteCond %REQUEST_FILENAME.php -f
    RewriteRule ^([^.]+)/$ http://subdomain.example.com/$1.php





    share|improve this answer

























    • I have a multi domain hosting plan. my primary website is hosted in web-root folder and a htaccess file is also placed in this we-root. And my site a.sprybirds.com is hosted in this web-root folder in sequence of folders web-root/sub_folder/site_folder . And I have another htaccess file in this site folder site_folder. I have provided the code in my is of htaccess file inside site_folder.

      – Kunwar Asif Ali Khan
      Jun 28 '15 at 11:28












    • @KunwarAsifAliKhan did you try removing the two lines as noted above? If so, did the error persist? Ideally, those two lines should be removed from all .htaccess files while troubleshooting. You can test whether or not you actually need -Indexes. Simply create an empty directory anywhere and access it. If you can browse it, then GoDaddy doesn't have this option enabled (although they really should...). If you can't browse, then this option isn't needed.

      – Jonathan
      Jun 28 '15 at 11:34












    • i have removed the above two line from htaccess file and my site is not showing internal sever error but another pages like a.sprybirds.com/business-search?find=food-beverage showing 404 error. I have used this htaccess to remove php extension and I have removed .php from all urls of my website.

      – Kunwar Asif Ali Khan
      Jun 28 '15 at 11:47











    • @KunwarAsifAliKhan Please see the modified post above. I've added an example I've used which worked on the last Apache 2.x server I was working on.

      – Jonathan
      Jun 28 '15 at 12:51












    • I have just paste the code that you have provided in my htaccess file. But I am still facing the problem 404 error when I not use .php but site with .php extension is working check url a.sprybirds.com/business-search.php?find=food-beverage

      – Kunwar Asif Ali Khan
      Jun 28 '15 at 13:21












    Your Answer








    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "2"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f702119%2fhow-to-remove-php-extension-using-htaccess-on-godaddy-linux-hosting%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The question is missing example URLs, which is really essential for diagnosing such problems, however...




    # Resolve .php file for extensionless php urls 
    RewriteRule ^([^/.]+)$ $1.php [L]



    This only matches URLs with single path segments, ie. URLs that are effectively in the document root, eg. /foo. It won't match URLs with multiple path segments, ie. URLs that are effectively in subdirectories eg. /foo/bar - which would explain why you are getting 404s for "php files inside the subfolder".



    You need to remove the slash in the RewriteRule pattern, in order to match any URL depth:



    RewriteRule ^([^.]+)$ $1.php [L]


    By including a slash in the negated character class you are only matching URLs that don't contain a slash. ie. URLs in the document root only.



    (There is no need to backslash escape a literal dot when used inside a character class.)






    share|improve this answer



























      0














      The question is missing example URLs, which is really essential for diagnosing such problems, however...




      # Resolve .php file for extensionless php urls 
      RewriteRule ^([^/.]+)$ $1.php [L]



      This only matches URLs with single path segments, ie. URLs that are effectively in the document root, eg. /foo. It won't match URLs with multiple path segments, ie. URLs that are effectively in subdirectories eg. /foo/bar - which would explain why you are getting 404s for "php files inside the subfolder".



      You need to remove the slash in the RewriteRule pattern, in order to match any URL depth:



      RewriteRule ^([^.]+)$ $1.php [L]


      By including a slash in the negated character class you are only matching URLs that don't contain a slash. ie. URLs in the document root only.



      (There is no need to backslash escape a literal dot when used inside a character class.)






      share|improve this answer

























        0












        0








        0







        The question is missing example URLs, which is really essential for diagnosing such problems, however...




        # Resolve .php file for extensionless php urls 
        RewriteRule ^([^/.]+)$ $1.php [L]



        This only matches URLs with single path segments, ie. URLs that are effectively in the document root, eg. /foo. It won't match URLs with multiple path segments, ie. URLs that are effectively in subdirectories eg. /foo/bar - which would explain why you are getting 404s for "php files inside the subfolder".



        You need to remove the slash in the RewriteRule pattern, in order to match any URL depth:



        RewriteRule ^([^.]+)$ $1.php [L]


        By including a slash in the negated character class you are only matching URLs that don't contain a slash. ie. URLs in the document root only.



        (There is no need to backslash escape a literal dot when used inside a character class.)






        share|improve this answer













        The question is missing example URLs, which is really essential for diagnosing such problems, however...




        # Resolve .php file for extensionless php urls 
        RewriteRule ^([^/.]+)$ $1.php [L]



        This only matches URLs with single path segments, ie. URLs that are effectively in the document root, eg. /foo. It won't match URLs with multiple path segments, ie. URLs that are effectively in subdirectories eg. /foo/bar - which would explain why you are getting 404s for "php files inside the subfolder".



        You need to remove the slash in the RewriteRule pattern, in order to match any URL depth:



        RewriteRule ^([^.]+)$ $1.php [L]


        By including a slash in the negated character class you are only matching URLs that don't contain a slash. ie. URLs in the document root only.



        (There is no need to backslash escape a literal dot when used inside a character class.)







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Oct 15 '18 at 14:22









        MrWhiteMrWhite

        6,43421426




        6,43421426























            0














            Do you have a .htaccess file in ./public_html/? If so, what's inside it? The way .htaccess works is by giving the directory closest to the actual root top priority.



            As an example:



            /home/username/public_html/.htaccess


            is given a higher priority (i.e. more control) than



            /home/username/public_html/sub_directory/.htaccess


            If you're primary .htaccess file is setting rules one way and the sub-directory is setting them another, it's possible you'll run in to issues (i.e. an error).



            If you're set in your actual web root, the following lines could be causing some issues as cPanel allows server administrators to set these options by default from within WHM. If these are already set (specifically -Indexes), you'll likely see an error.



            Options All -Indexes
            Options +FollowSymLinks -MultiViews


            Note: The -Indexes directive is normally set by default before clients are even placed on a server (or it should be, unless there's a specific reason not to), FYI. This is more of a security recommendation to prevent directory browsing as not every client is going to know that unless there's an index.[ext] file in every directory, their directories are wide-open for browsing by whoever wants to take a look.




            If removing those resolves the error, then you've found the problem :). If removing these lines does not work, trial & error is where we need to start.



            Back to the top, look in directories that reside above the directory you're having issues with. Check the .htaccess files and make sure you have "display or show hidden files" checked or set to "yes" in the S/FTP program that you're using as they're not always visible by default.



            From here, the best course of action would be to backup each .htaccess file and re-add them one-by-one until you run in to another error. This way you can mark down which file upload brought on the error and we can take a look at that one.




            Update #01



            Since the culprit for the error most likely was indeed the -Indexes, you can add the following back to the .htaccess file:



            Options +FollowSymLinks -MultiViews


            If that does not resolve the 404, try this:



            Options +FollowSymLinks -MultiViews
            RewriteEngine On
            RewriteBase /

            # Adds Trailing Slash to the URI as long as it's not for a
            # file.
            RewriteCond %REQUEST_FILENAME !-f
            RewriteCond %REQUEST_URI !(.[a-zA-Z0-9]1,5|/|#(.*))$
            RewriteRule ^(.*)$ http://subdomain.example.com/$1/ [R=301,L]

            # Checks to make sure the request is a directory.
            # Checks to see if the request matches a file with a .php ext.
            # If all is well, push the request through to the matching file.
            RewriteCond %REQUEST_FILENAME !-d
            RewriteCond %REQUEST_FILENAME.php -f
            RewriteRule ^([^.]+)/$ http://subdomain.example.com/$1.php





            share|improve this answer

























            • I have a multi domain hosting plan. my primary website is hosted in web-root folder and a htaccess file is also placed in this we-root. And my site a.sprybirds.com is hosted in this web-root folder in sequence of folders web-root/sub_folder/site_folder . And I have another htaccess file in this site folder site_folder. I have provided the code in my is of htaccess file inside site_folder.

              – Kunwar Asif Ali Khan
              Jun 28 '15 at 11:28












            • @KunwarAsifAliKhan did you try removing the two lines as noted above? If so, did the error persist? Ideally, those two lines should be removed from all .htaccess files while troubleshooting. You can test whether or not you actually need -Indexes. Simply create an empty directory anywhere and access it. If you can browse it, then GoDaddy doesn't have this option enabled (although they really should...). If you can't browse, then this option isn't needed.

              – Jonathan
              Jun 28 '15 at 11:34












            • i have removed the above two line from htaccess file and my site is not showing internal sever error but another pages like a.sprybirds.com/business-search?find=food-beverage showing 404 error. I have used this htaccess to remove php extension and I have removed .php from all urls of my website.

              – Kunwar Asif Ali Khan
              Jun 28 '15 at 11:47











            • @KunwarAsifAliKhan Please see the modified post above. I've added an example I've used which worked on the last Apache 2.x server I was working on.

              – Jonathan
              Jun 28 '15 at 12:51












            • I have just paste the code that you have provided in my htaccess file. But I am still facing the problem 404 error when I not use .php but site with .php extension is working check url a.sprybirds.com/business-search.php?find=food-beverage

              – Kunwar Asif Ali Khan
              Jun 28 '15 at 13:21
















            0














            Do you have a .htaccess file in ./public_html/? If so, what's inside it? The way .htaccess works is by giving the directory closest to the actual root top priority.



            As an example:



            /home/username/public_html/.htaccess


            is given a higher priority (i.e. more control) than



            /home/username/public_html/sub_directory/.htaccess


            If you're primary .htaccess file is setting rules one way and the sub-directory is setting them another, it's possible you'll run in to issues (i.e. an error).



            If you're set in your actual web root, the following lines could be causing some issues as cPanel allows server administrators to set these options by default from within WHM. If these are already set (specifically -Indexes), you'll likely see an error.



            Options All -Indexes
            Options +FollowSymLinks -MultiViews


            Note: The -Indexes directive is normally set by default before clients are even placed on a server (or it should be, unless there's a specific reason not to), FYI. This is more of a security recommendation to prevent directory browsing as not every client is going to know that unless there's an index.[ext] file in every directory, their directories are wide-open for browsing by whoever wants to take a look.




            If removing those resolves the error, then you've found the problem :). If removing these lines does not work, trial & error is where we need to start.



            Back to the top, look in directories that reside above the directory you're having issues with. Check the .htaccess files and make sure you have "display or show hidden files" checked or set to "yes" in the S/FTP program that you're using as they're not always visible by default.



            From here, the best course of action would be to backup each .htaccess file and re-add them one-by-one until you run in to another error. This way you can mark down which file upload brought on the error and we can take a look at that one.




            Update #01



            Since the culprit for the error most likely was indeed the -Indexes, you can add the following back to the .htaccess file:



            Options +FollowSymLinks -MultiViews


            If that does not resolve the 404, try this:



            Options +FollowSymLinks -MultiViews
            RewriteEngine On
            RewriteBase /

            # Adds Trailing Slash to the URI as long as it's not for a
            # file.
            RewriteCond %REQUEST_FILENAME !-f
            RewriteCond %REQUEST_URI !(.[a-zA-Z0-9]1,5|/|#(.*))$
            RewriteRule ^(.*)$ http://subdomain.example.com/$1/ [R=301,L]

            # Checks to make sure the request is a directory.
            # Checks to see if the request matches a file with a .php ext.
            # If all is well, push the request through to the matching file.
            RewriteCond %REQUEST_FILENAME !-d
            RewriteCond %REQUEST_FILENAME.php -f
            RewriteRule ^([^.]+)/$ http://subdomain.example.com/$1.php





            share|improve this answer

























            • I have a multi domain hosting plan. my primary website is hosted in web-root folder and a htaccess file is also placed in this we-root. And my site a.sprybirds.com is hosted in this web-root folder in sequence of folders web-root/sub_folder/site_folder . And I have another htaccess file in this site folder site_folder. I have provided the code in my is of htaccess file inside site_folder.

              – Kunwar Asif Ali Khan
              Jun 28 '15 at 11:28












            • @KunwarAsifAliKhan did you try removing the two lines as noted above? If so, did the error persist? Ideally, those two lines should be removed from all .htaccess files while troubleshooting. You can test whether or not you actually need -Indexes. Simply create an empty directory anywhere and access it. If you can browse it, then GoDaddy doesn't have this option enabled (although they really should...). If you can't browse, then this option isn't needed.

              – Jonathan
              Jun 28 '15 at 11:34












            • i have removed the above two line from htaccess file and my site is not showing internal sever error but another pages like a.sprybirds.com/business-search?find=food-beverage showing 404 error. I have used this htaccess to remove php extension and I have removed .php from all urls of my website.

              – Kunwar Asif Ali Khan
              Jun 28 '15 at 11:47











            • @KunwarAsifAliKhan Please see the modified post above. I've added an example I've used which worked on the last Apache 2.x server I was working on.

              – Jonathan
              Jun 28 '15 at 12:51












            • I have just paste the code that you have provided in my htaccess file. But I am still facing the problem 404 error when I not use .php but site with .php extension is working check url a.sprybirds.com/business-search.php?find=food-beverage

              – Kunwar Asif Ali Khan
              Jun 28 '15 at 13:21














            0












            0








            0







            Do you have a .htaccess file in ./public_html/? If so, what's inside it? The way .htaccess works is by giving the directory closest to the actual root top priority.



            As an example:



            /home/username/public_html/.htaccess


            is given a higher priority (i.e. more control) than



            /home/username/public_html/sub_directory/.htaccess


            If you're primary .htaccess file is setting rules one way and the sub-directory is setting them another, it's possible you'll run in to issues (i.e. an error).



            If you're set in your actual web root, the following lines could be causing some issues as cPanel allows server administrators to set these options by default from within WHM. If these are already set (specifically -Indexes), you'll likely see an error.



            Options All -Indexes
            Options +FollowSymLinks -MultiViews


            Note: The -Indexes directive is normally set by default before clients are even placed on a server (or it should be, unless there's a specific reason not to), FYI. This is more of a security recommendation to prevent directory browsing as not every client is going to know that unless there's an index.[ext] file in every directory, their directories are wide-open for browsing by whoever wants to take a look.




            If removing those resolves the error, then you've found the problem :). If removing these lines does not work, trial & error is where we need to start.



            Back to the top, look in directories that reside above the directory you're having issues with. Check the .htaccess files and make sure you have "display or show hidden files" checked or set to "yes" in the S/FTP program that you're using as they're not always visible by default.



            From here, the best course of action would be to backup each .htaccess file and re-add them one-by-one until you run in to another error. This way you can mark down which file upload brought on the error and we can take a look at that one.




            Update #01



            Since the culprit for the error most likely was indeed the -Indexes, you can add the following back to the .htaccess file:



            Options +FollowSymLinks -MultiViews


            If that does not resolve the 404, try this:



            Options +FollowSymLinks -MultiViews
            RewriteEngine On
            RewriteBase /

            # Adds Trailing Slash to the URI as long as it's not for a
            # file.
            RewriteCond %REQUEST_FILENAME !-f
            RewriteCond %REQUEST_URI !(.[a-zA-Z0-9]1,5|/|#(.*))$
            RewriteRule ^(.*)$ http://subdomain.example.com/$1/ [R=301,L]

            # Checks to make sure the request is a directory.
            # Checks to see if the request matches a file with a .php ext.
            # If all is well, push the request through to the matching file.
            RewriteCond %REQUEST_FILENAME !-d
            RewriteCond %REQUEST_FILENAME.php -f
            RewriteRule ^([^.]+)/$ http://subdomain.example.com/$1.php





            share|improve this answer















            Do you have a .htaccess file in ./public_html/? If so, what's inside it? The way .htaccess works is by giving the directory closest to the actual root top priority.



            As an example:



            /home/username/public_html/.htaccess


            is given a higher priority (i.e. more control) than



            /home/username/public_html/sub_directory/.htaccess


            If you're primary .htaccess file is setting rules one way and the sub-directory is setting them another, it's possible you'll run in to issues (i.e. an error).



            If you're set in your actual web root, the following lines could be causing some issues as cPanel allows server administrators to set these options by default from within WHM. If these are already set (specifically -Indexes), you'll likely see an error.



            Options All -Indexes
            Options +FollowSymLinks -MultiViews


            Note: The -Indexes directive is normally set by default before clients are even placed on a server (or it should be, unless there's a specific reason not to), FYI. This is more of a security recommendation to prevent directory browsing as not every client is going to know that unless there's an index.[ext] file in every directory, their directories are wide-open for browsing by whoever wants to take a look.




            If removing those resolves the error, then you've found the problem :). If removing these lines does not work, trial & error is where we need to start.



            Back to the top, look in directories that reside above the directory you're having issues with. Check the .htaccess files and make sure you have "display or show hidden files" checked or set to "yes" in the S/FTP program that you're using as they're not always visible by default.



            From here, the best course of action would be to backup each .htaccess file and re-add them one-by-one until you run in to another error. This way you can mark down which file upload brought on the error and we can take a look at that one.




            Update #01



            Since the culprit for the error most likely was indeed the -Indexes, you can add the following back to the .htaccess file:



            Options +FollowSymLinks -MultiViews


            If that does not resolve the 404, try this:



            Options +FollowSymLinks -MultiViews
            RewriteEngine On
            RewriteBase /

            # Adds Trailing Slash to the URI as long as it's not for a
            # file.
            RewriteCond %REQUEST_FILENAME !-f
            RewriteCond %REQUEST_URI !(.[a-zA-Z0-9]1,5|/|#(.*))$
            RewriteRule ^(.*)$ http://subdomain.example.com/$1/ [R=301,L]

            # Checks to make sure the request is a directory.
            # Checks to see if the request matches a file with a .php ext.
            # If all is well, push the request through to the matching file.
            RewriteCond %REQUEST_FILENAME !-d
            RewriteCond %REQUEST_FILENAME.php -f
            RewriteRule ^([^.]+)/$ http://subdomain.example.com/$1.php






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Oct 15 '18 at 14:26









            MrWhite

            6,43421426




            6,43421426










            answered Jun 28 '15 at 10:59









            JonathanJonathan

            112




            112












            • I have a multi domain hosting plan. my primary website is hosted in web-root folder and a htaccess file is also placed in this we-root. And my site a.sprybirds.com is hosted in this web-root folder in sequence of folders web-root/sub_folder/site_folder . And I have another htaccess file in this site folder site_folder. I have provided the code in my is of htaccess file inside site_folder.

              – Kunwar Asif Ali Khan
              Jun 28 '15 at 11:28












            • @KunwarAsifAliKhan did you try removing the two lines as noted above? If so, did the error persist? Ideally, those two lines should be removed from all .htaccess files while troubleshooting. You can test whether or not you actually need -Indexes. Simply create an empty directory anywhere and access it. If you can browse it, then GoDaddy doesn't have this option enabled (although they really should...). If you can't browse, then this option isn't needed.

              – Jonathan
              Jun 28 '15 at 11:34












            • i have removed the above two line from htaccess file and my site is not showing internal sever error but another pages like a.sprybirds.com/business-search?find=food-beverage showing 404 error. I have used this htaccess to remove php extension and I have removed .php from all urls of my website.

              – Kunwar Asif Ali Khan
              Jun 28 '15 at 11:47











            • @KunwarAsifAliKhan Please see the modified post above. I've added an example I've used which worked on the last Apache 2.x server I was working on.

              – Jonathan
              Jun 28 '15 at 12:51












            • I have just paste the code that you have provided in my htaccess file. But I am still facing the problem 404 error when I not use .php but site with .php extension is working check url a.sprybirds.com/business-search.php?find=food-beverage

              – Kunwar Asif Ali Khan
              Jun 28 '15 at 13:21


















            • I have a multi domain hosting plan. my primary website is hosted in web-root folder and a htaccess file is also placed in this we-root. And my site a.sprybirds.com is hosted in this web-root folder in sequence of folders web-root/sub_folder/site_folder . And I have another htaccess file in this site folder site_folder. I have provided the code in my is of htaccess file inside site_folder.

              – Kunwar Asif Ali Khan
              Jun 28 '15 at 11:28












            • @KunwarAsifAliKhan did you try removing the two lines as noted above? If so, did the error persist? Ideally, those two lines should be removed from all .htaccess files while troubleshooting. You can test whether or not you actually need -Indexes. Simply create an empty directory anywhere and access it. If you can browse it, then GoDaddy doesn't have this option enabled (although they really should...). If you can't browse, then this option isn't needed.

              – Jonathan
              Jun 28 '15 at 11:34












            • i have removed the above two line from htaccess file and my site is not showing internal sever error but another pages like a.sprybirds.com/business-search?find=food-beverage showing 404 error. I have used this htaccess to remove php extension and I have removed .php from all urls of my website.

              – Kunwar Asif Ali Khan
              Jun 28 '15 at 11:47











            • @KunwarAsifAliKhan Please see the modified post above. I've added an example I've used which worked on the last Apache 2.x server I was working on.

              – Jonathan
              Jun 28 '15 at 12:51












            • I have just paste the code that you have provided in my htaccess file. But I am still facing the problem 404 error when I not use .php but site with .php extension is working check url a.sprybirds.com/business-search.php?find=food-beverage

              – Kunwar Asif Ali Khan
              Jun 28 '15 at 13:21

















            I have a multi domain hosting plan. my primary website is hosted in web-root folder and a htaccess file is also placed in this we-root. And my site a.sprybirds.com is hosted in this web-root folder in sequence of folders web-root/sub_folder/site_folder . And I have another htaccess file in this site folder site_folder. I have provided the code in my is of htaccess file inside site_folder.

            – Kunwar Asif Ali Khan
            Jun 28 '15 at 11:28






            I have a multi domain hosting plan. my primary website is hosted in web-root folder and a htaccess file is also placed in this we-root. And my site a.sprybirds.com is hosted in this web-root folder in sequence of folders web-root/sub_folder/site_folder . And I have another htaccess file in this site folder site_folder. I have provided the code in my is of htaccess file inside site_folder.

            – Kunwar Asif Ali Khan
            Jun 28 '15 at 11:28














            @KunwarAsifAliKhan did you try removing the two lines as noted above? If so, did the error persist? Ideally, those two lines should be removed from all .htaccess files while troubleshooting. You can test whether or not you actually need -Indexes. Simply create an empty directory anywhere and access it. If you can browse it, then GoDaddy doesn't have this option enabled (although they really should...). If you can't browse, then this option isn't needed.

            – Jonathan
            Jun 28 '15 at 11:34






            @KunwarAsifAliKhan did you try removing the two lines as noted above? If so, did the error persist? Ideally, those two lines should be removed from all .htaccess files while troubleshooting. You can test whether or not you actually need -Indexes. Simply create an empty directory anywhere and access it. If you can browse it, then GoDaddy doesn't have this option enabled (although they really should...). If you can't browse, then this option isn't needed.

            – Jonathan
            Jun 28 '15 at 11:34














            i have removed the above two line from htaccess file and my site is not showing internal sever error but another pages like a.sprybirds.com/business-search?find=food-beverage showing 404 error. I have used this htaccess to remove php extension and I have removed .php from all urls of my website.

            – Kunwar Asif Ali Khan
            Jun 28 '15 at 11:47





            i have removed the above two line from htaccess file and my site is not showing internal sever error but another pages like a.sprybirds.com/business-search?find=food-beverage showing 404 error. I have used this htaccess to remove php extension and I have removed .php from all urls of my website.

            – Kunwar Asif Ali Khan
            Jun 28 '15 at 11:47













            @KunwarAsifAliKhan Please see the modified post above. I've added an example I've used which worked on the last Apache 2.x server I was working on.

            – Jonathan
            Jun 28 '15 at 12:51






            @KunwarAsifAliKhan Please see the modified post above. I've added an example I've used which worked on the last Apache 2.x server I was working on.

            – Jonathan
            Jun 28 '15 at 12:51














            I have just paste the code that you have provided in my htaccess file. But I am still facing the problem 404 error when I not use .php but site with .php extension is working check url a.sprybirds.com/business-search.php?find=food-beverage

            – Kunwar Asif Ali Khan
            Jun 28 '15 at 13:21






            I have just paste the code that you have provided in my htaccess file. But I am still facing the problem 404 error when I not use .php but site with .php extension is working check url a.sprybirds.com/business-search.php?find=food-beverage

            – Kunwar Asif Ali Khan
            Jun 28 '15 at 13:21


















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Server Fault!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f702119%2fhow-to-remove-php-extension-using-htaccess-on-godaddy-linux-hosting%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Wikipedia:Vital articles Мазмуну Biography - Өмүр баян Philosophy and psychology - Философия жана психология Religion - Дин Social sciences - Коомдук илимдер Language and literature - Тил жана адабият Science - Илим Technology - Технология Arts and recreation - Искусство жана эс алуу History and geography - Тарых жана география Навигация менюсу

            Bruxelas-Capital Índice Historia | Composición | Situación lingüística | Clima | Cidades irmandadas | Notas | Véxase tamén | Menú de navegacióneO uso das linguas en Bruxelas e a situación do neerlandés"Rexión de Bruxelas Capital"o orixinalSitio da rexiónPáxina de Bruselas no sitio da Oficina de Promoción Turística de Valonia e BruxelasMapa Interactivo da Rexión de Bruxelas-CapitaleeWorldCat332144929079854441105155190212ID28008674080552-90000 0001 0666 3698n94104302ID540940339365017018237

            What should I write in an apology letter, since I have decided not to join a company after accepting an offer letterShould I keep looking after accepting a job offer?What should I do when I've been verbally told I would get an offer letter, but still haven't gotten one after 4 weeks?Do I accept an offer from a company that I am not likely to join?New job hasn't confirmed starting date and I want to give current employer as much notice as possibleHow should I address my manager in my resignation letter?HR delayed background verification, now jobless as resignedNo email communication after accepting a formal written offer. How should I phrase the call?What should I do if after receiving a verbal offer letter I am informed that my written job offer is put on hold due to some internal issues?Should I inform the current employer that I am about to resign within 1-2 weeks since I have signed the offer letter and waiting for visa?What company will do, if I send their offer letter to another company