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 117489
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T03:20:40+00:00 2026-05-11T03:20:40+00:00

RewriteEngine on RewriteRule ^page/?$ page.php [L] This ends up matching the url www.site.com/page// but

  • 0
RewriteEngine on RewriteRule ^page/?$ page.php [L] 

This ends up matching the url http://www.site.com/page// but internally it acts differently than http://www.site.com/page/ because the stylesheets and images no longer appear properly. Am I doing something wrong or is this just something I need to deal with if I don’t want to go through a lot of trouble?

To me it looks like it should only match http://www.site.com/page or http://www.site.com/page/

  • 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. 2026-05-11T03:20:41+00:00Added an answer on May 11, 2026 at 3:20 am

    Apache strips the empty path segment. So /path// is treated as /path/. But your browser doesn’t so relative URLs are resolved using /path//.

    If you want to remove the multiple slashes, you can use the following rule:

    RewriteCond %{THE_REQUEST} ^[A-Z]+\ /(([^/\ ]+/)*)/+([^\ ]*) RewriteRule ^ /%1%3 [L,R=301] 

    Explaination

    Despite Apache removes empty path segments internal, the THE_REQUEST environment variable (holding the HTTP request line) stays untouched. So we can use this value to check for multiple slashes.

    • ^[A-Z]+\ / matches the request method, the following space and the first slash character of the URI path.
    • (([^/\ ]+/)*) matches all following non-empty path segments (foo/, foo/bar/, foo/bar/baz/, etc.) or nothing, if there are none.
    • /+ matches the empty path segments as the character before this slash is always another slash (see the expressions before).
    • ([^\ ]*) matches the rest of the URI (that may contain further empty path segments).

    Example: Let’s say we request http://example.com/foo/bar//baz, the request line will look like this:

    GET /foo/bar//baz HTTP/1.1 

    The pattern would then match as follows:

    0: GET /foo/bar//baz 1: foo/bar/ 2: bar/ 3: baz 

    So the requested path /foo/bar//baz would be redirected to /foo/bar/baz (/%1%3).

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

Sidebar

Related Questions

Currently i have url parameters like this http://www.website.com/index.php?user&page=edit And in index.php i have set
I have this htaccess rule to redirect my page to data_parser.php RewriteEngine On RewriteRule
I am using this, at present, to rewrite URLS: RewriteEngine on RewriteRule ^([^/?\.]+)$ /page.php?name=$1
I have a url rewrite that looks like this: RewriteEngine On RewriteRule ^cancun/tours/$ location-tours-listings.php?locationName=Cancun
this is my code RewriteEngine on RewriteRule ^public/p-(.*)\&(.*)?$ public/index.php?page=$1.php&$2 [NC,L] RewriteRule ^public/p-(.*)$ public/index.php?page=$1.php This
This is what I want - When somebody enters site.com/page.php or site.com/page or site.com/page/
I have the following mod_rewrite: Options +FollowSymLinks RewriteEngine On RewriteRule ^register index.php?page=register The url
My htaccess: RewriteEngine On RewriteRule ^(.*)/(.*)$ /index.php?cat=$1&page=$2 [L] Now my css is located at:
this is my mod_rewrite rule: RewriteEngine On RewriteRule ^([^./]+)/?$ index.php?id=$1 [L] That will rewrite
I've got this in htaccess RewriteEngine On RewriteRule ^records$ records.php [L] RewriteRule ^records/$ records.php

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.