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 in PHP by Kithuzzz
• 3,660 points
7 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,740 points
627 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,740 points
1,721 views
0 votes
0 answers

Remove Image background with php and save transparent png

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

May 27 in PHP by Kichu
• 19,040 points
257 views
0 votes
0 answers

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

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

5 days ago in PHP by Kithuzzz
• 3,660 points
8 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,740 points
1,362 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 in PHP by narikkadan
• 11,280 points
168 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 in Others by narikkadan
• 11,280 points
102 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 in Others by narikkadan
• 11,280 points
873 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 in Others by narikkadan
• 11,280 points
173 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP