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

  • Home
  • SEARCH
  • 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 7670887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:55:29+00:00 2026-05-31T15:55:29+00:00

I have a link on the main page to www.example.com/test I have a page

  • 0

I have a link on the main page to

www.example.com/test

I have a page in a pages directory, called test.php

Here’s what my .htaccess looks like:

RewriteBase /
RewriteEngine on  
RewriteCond pages/%{REQUEST_FILENAME}.php -f [NC]
RewriteRule ^(.*?)$ pages/$1.php

Now, I can get it to work with RewriteRule ^test$ pages/test.php, but as soon as I put in the regex, it won’t work. Also, the RewriteCond rule doesn’t seem to work either. Any solutions you can think of? I have tried adding Options +FollowSymlinks -MultiViews but it didn’t work.

update

If I add a test.php to the main directory, then change RewriteCond pages/%{REQUEST_FILENAME}.php -f [NC] to RewriteCond %{REQUEST_FILENAME}.php -f [NC] then it works; so that is where the problem is.

I can’t figure out how to check if the file exists in the pages directory.

  • 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-31T15:55:30+00:00Added an answer on May 31, 2026 at 3:55 pm

    REQUEST_FILENAME is the full server path. So if your document root path is /home/website/public/ you are trying to check if pages/home/website/public/test.php exists, which of course it doesn’t.

    Here are the rules you want.

    RewriteBase /
    RewriteEngine on  
    RewriteCond %{DOCUMENT_ROOT}/pages/%{REQUEST_URI}.php -f [NC]
    RewriteRule ^(.*?)$ pages/$1.php
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have link for example domain.com/de/controler/action?param=value and I want make actionlink to keep same
I have a link that opens a Thickbox... <a href=page.php?tag=lists-element&keepThis=true&TB_iframe=true&height=450&width=500> Everything works with this
I have two pages one is the main page and the another one is
Okay so on my homepage http://www.stat-me.com i have a link that when pressed activates
Website test page: http://www.lantiis.com/indexold.html jsFiddle: http://jsfiddle.net/Guhb4/7/ I received help with the jQuery and it
In my main CSS file, I have my a:link selector set to display links
I have main.cpp (including main function) and func1.cpp, and I want to link these
I have several sites that I want to link back to the main site
I have a link on a page that pops up a new window, and
I have a link to a page which invokes the 'Sexy Alert Box' script

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.