Remove php extension with htaccess

0 votes

I looked here and read the Apache documentation. I just can't seem to get this to work for some reason. I've gotten as far as trying to get it to delete the extension, but it still points to the root directory. I only want this to function in the directory where the.htaccess file is located.

I have three things I need to perform with the.htaccess file.

  1. I need it to remove the .php

a. I have several pages that use tabs and the URL looks like page.php#tab - is this possible?

b. I have one page that uses a session ID appended to the URL to make sure you came from the right place, www.domain.example/download-software.php?abcdefg.

Can this be done? Do the links in my header nav include file still have.php once I do this? Should the IE "support.php" link be changed to "support" in the URL?

  1. I want it to require the www prefix before every URL, so instead of domain.example/page, it will be www.domain.example/page.
  2. I want to get rid of every last trailing slash on pages.

I'll continue to search, attempt, etc. Does it matter whether I'm in a subdirectory?

Jul 30, 2022 in PHP by Kithuzzz
• 38,000 points
1,001 views

No answer to this question. Be the first to respond.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.

Related Questions In PHP

0 votes
1 answer

How to remove GET-variables with PHP?

Hello @kartik, Try this: preg_replace('/\\?.*/', '', $str) Hope ...READ MORE

answered Oct 27, 2020 in PHP by Niroj
• 82,840 points
2,219 views
0 votes
1 answer

How to remove a child with a specific attribute, in SimpleXML for PHP?

Hii, Just unset the node: $str = <<<STR <a> ...READ MORE

answered Nov 5, 2020 in PHP by Niroj
• 82,840 points
4,296 views
0 votes
0 answers

Remove Image background with php and save transparent png

I am working on functionality that removes ...READ MORE

May 27, 2022 in PHP by Kichu
• 19,040 points
3,161 views
0 votes
0 answers
0 votes
0 answers

Can I dynamically create subdomains (PHP, .htaccess) with GoDaddy Hosting?

On my GoDaddy Hosting account, I'm attempting ...READ MORE

Aug 7, 2022 in PHP by Kithuzzz
• 38,000 points
852 views
0 votes
1 answer

How to Validate Form Data With PHP?

Hey @kartik, The first thing we will do ...READ MORE

answered Feb 13, 2020 in PHP by Niroj
• 82,840 points
3,327 views
0 votes
0 answers

ErrorDocument 404 /404.php is not working in .htaccess file in PHP

This is the Content of my .htaccess file is: ErrorDocument ...READ MORE

Jun 21, 2022 in PHP by narikkadan
• 63,600 points
833 views
0 votes
1 answer

Enabling SEO Optimizer in Magento 1.7 returns 404 error page on frontend links

Modified Magento's stock .htaccess to fit my ...READ MORE

answered Feb 10, 2022 in Others by narikkadan
• 63,600 points
605 views
0 votes
1 answer

Generator URL Friendly SEO PHP with .htaccess

Options +FollowSymLinks -MultiViews RewriteEngine on RewriteBase / # skip all ...READ MORE

answered Feb 14, 2022 in Others by narikkadan
• 63,600 points
4,453 views
0 votes
1 answer

mod_rewrite seo friendly url passed as parameter only works with prefix on url

RewriteEngine On RewriteRule ^content/get_content.php\?url\=seo-friendly-url$ /content/seo-friendly-url [L] try this code ...READ MORE

answered Feb 24, 2022 in Others by narikkadan
• 63,600 points
1,773 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP