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

            Club Baloncesto Breogán Índice Historia | Pavillón | Nome | O Breogán na cultura popular | Xogadores | Adestradores | Presidentes | Palmarés | Historial | Líderes | Notas | Véxase tamén | Menú de navegacióncbbreogan.galCadroGuía oficial da ACB 2009-10, páxina 201Guía oficial ACB 1992, páxina 183. Editorial DB.É de 6.500 espectadores sentados axeitándose á última normativa"Estudiantes Junior, entre as mellores canteiras"o orixinalHemeroteca El Mundo Deportivo, 16 setembro de 1970, páxina 12Historia do BreogánAlfredo Pérez, o último canoneiroHistoria C.B. BreogánHemeroteca de El Mundo DeportivoJimmy Wright, norteamericano do Breogán deixará Lugo por ameazas de morteResultados de Breogán en 1986-87Resultados de Breogán en 1990-91Ficha de Velimir Perasović en acb.comResultados de Breogán en 1994-95Breogán arrasa al Barça. "El Mundo Deportivo", 27 de setembro de 1999, páxina 58CB Breogán - FC BarcelonaA FEB invita a participar nunha nova Liga EuropeaCharlie Bell na prensa estatalMáximos anotadores 2005Tempada 2005-06 : Tódolos Xogadores da Xornada""Non quero pensar nunha man negra, mais pregúntome que está a pasar""o orixinalRaúl López, orgulloso dos xogadores, presume da boa saúde económica do BreogánJulio González confirma que cesa como presidente del BreogánHomenaxe a Lisardo GómezA tempada do rexurdimento celesteEntrevista a Lisardo GómezEl COB dinamita el Pazo para forzar el quinto (69-73)Cafés Candelas, patrocinador del CB Breogán"Suso Lázare, novo presidente do Breogán"o orixinalCafés Candelas Breogán firma el mayor triunfo de la historiaEl Breogán realizará 17 homenajes por su cincuenta aniversario"O Breogán honra ao seu fundador e primeiro presidente"o orixinalMiguel Giao recibiu a homenaxe do PazoHomenaxe aos primeiros gladiadores celestesO home que nos amosa como ver o Breo co corazónTita Franco será homenaxeada polos #50anosdeBreoJulio Vila recibirá unha homenaxe in memoriam polos #50anosdeBreo"O Breogán homenaxeará aos seus aboados máis veteráns"Pechada ovación a «Capi» Sanmartín e Ricardo «Corazón de González»Homenaxe por décadas de informaciónPaco García volve ao Pazo con motivo do 50 aniversario"Resultados y clasificaciones""O Cafés Candelas Breogán, campión da Copa Princesa""O Cafés Candelas Breogán, equipo ACB"C.B. Breogán"Proxecto social"o orixinal"Centros asociados"o orixinalFicha en imdb.comMario Camus trata la recuperación del amor en 'La vieja música', su última película"Páxina web oficial""Club Baloncesto Breogán""C. B. Breogán S.A.D."eehttp://www.fegaba.com

            Vilaño, A Laracha Índice Patrimonio | Lugares e parroquias | Véxase tamén | Menú de navegación43°14′52″N 8°36′03″O / 43.24775, -8.60070

            Cegueira Índice Epidemioloxía | Deficiencia visual | Tipos de cegueira | Principais causas de cegueira | Tratamento | Técnicas de adaptación e axudas | Vida dos cegos | Primeiros auxilios | Crenzas respecto das persoas cegas | Crenzas das persoas cegas | O neno deficiente visual | Aspectos psicolóxicos da cegueira | Notas | Véxase tamén | Menú de navegación54.054.154.436928256blindnessDicionario da Real Academia GalegaPortal das Palabras"International Standards: Visual Standards — Aspects and Ranges of Vision Loss with Emphasis on Population Surveys.""Visual impairment and blindness""Presentan un plan para previr a cegueira"o orixinalACCDV Associació Catalana de Cecs i Disminuïts Visuals - PMFTrachoma"Effect of gene therapy on visual function in Leber's congenital amaurosis"1844137110.1056/NEJMoa0802268Cans guía - os mellores amigos dos cegosArquivadoEscola de cans guía para cegos en Mortágua, PortugalArquivado"Tecnología para ciegos y deficientes visuales. Recopilación de recursos gratuitos en la Red""Colorino""‘COL.diesis’, escuchar los sonidos del color""COL.diesis: Transforming Colour into Melody and Implementing the Result in a Colour Sensor Device"o orixinal"Sistema de desarrollo de sinestesia color-sonido para invidentes utilizando un protocolo de audio""Enseñanza táctil - geometría y color. Juegos didácticos para niños ciegos y videntes""Sistema Constanz"L'ocupació laboral dels cecs a l'Estat espanyol està pràcticament equiparada a la de les persones amb visió, entrevista amb Pedro ZuritaONCE (Organización Nacional de Cegos de España)Prevención da cegueiraDescrición de deficiencias visuais (Disc@pnet)Braillín, un boneco atractivo para calquera neno, con ou sen discapacidade, que permite familiarizarse co sistema de escritura e lectura brailleAxudas Técnicas36838ID00897494007150-90057129528256DOID:1432HP:0000618D001766C10.597.751.941.162C97109C0155020