Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4332044
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:12:02+00:00 2026-05-21T10:12:02+00:00

I want to replace my.example.com/newsletter.php or example.com/newsletter.php to be example.com/newsletter/ I tried this: RewriteEngine

  • 0

I want to replace my.example.com/newsletter.php or example.com/newsletter.php to be example.com/newsletter/

I tried this:

RewriteEngine On
RewriteRule ^([a-z]+)$ /$1.php [L]

and what if I want http://example.com/communities/index.php?sub_id=1

to be a specific name like http://example.com/communities/Bridlewood/

possible?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T10:12:03+00:00Added an answer on May 21, 2026 at 10:12 am

    The other answers are right about the leading slash, and you should catch the possibility of a trailing slash (bearing in mind that ‘$’ marks the end of a string .

    Try something like this:

    RewriteBase /
    
    RewriteCond %{SCRIPT_FILENAME} !-f
    RewriteCond %{SCRIPT_FILENAME} !-d
    
    RewriteRule ^([a-z-]+)/?$ /$1.php [QSA,NC,L]
    

    Note: The QSA flag stands for ‘query string append’ and will pass any url query on to the relevant page.

    hth

    EDIT: For URL’s that contain characters other than lower case alpha’s you should change the range group, use a case-insensitive switch or simply use (.*) as per other peoples examples!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a link like this: <a href=http://example.com>text</a> and replace the behavior
Using str_replace I want to change $url from this: $url = http://example.com/images/lala1.jpg to this
I want to use PHP to replace javascript functions in HTML documents. For example:
I want to make this by the preg_replace : $web = 'example.com'; I want
I have an URL http://example.com/test?xyz=27373&page=4&test=5 which I want to tranform by replacing the page=4
I have an excel file with urls of type http://test.example.com/anything ... i want to
I want the htaccess Redirect 301 to do the following using regex: http://example.com/folder/abc_123_123.htm to
I want to insert the following line into my xml file: <?xml-stylesheet type=text/xsl href=http://example.com/livesearch.xsl?>
String arg=http://www.example.com/user.php?id=<URLRequest Method='GetByUID' />; java.net.URI uri = new java.net.URI( arg ); java.awt.Desktop desktop =
I want to take an XML file and replace an element's value. For example

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.