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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:14:14+00:00 2026-05-22T21:14:14+00:00

I am trying to get Apache 2.2 mod_rewrite to get clean urls. I have

  • 0

I am trying to get Apache 2.2 mod_rewrite to get clean urls.
I have links such as

<ul>
<li><a href="index.php?view=pageName">Page Name</a></li>
<li><a href="index.php?view=pageName2">Page Name2</a></li>
<li><a href="index.php?view=pageName3">Page Name3</a></li>
</ul>

and url comes out to be

http://example.com/user/index.php?view=pageName

I would like to clean the url in the address bar it to this

http://example.com/user/pageName

Edit: This is what’s in my httpd.conf if it’s any use.

<Directory "C:/Apache2.2/htdocs/user">
    Options Indexes FollowSymLinks
    AllowOverride all
    order allow,deny
    Allow from all
</Directory>

Using phpinfo() I have verified that mod_rewrite is loaded and I have this in my .htaccess (user file, Not root .htaccess) and not virtual user on apache

RewriteEngine on
RewriteBase /user/ #Edited rewrite base added in, but not helping much.
RewriteOptions Inherit
RewriteRule ^/user/([a-zA-Z])/?$ index.php?view=$1  [NC,L] 

Edit: the rest of my .htaccess

#Ensure browser reads Header
Header unset ETag
FileETag None
Header unset Last-Modified

#Set caching expires
Header set Expires On
ExpiresDefault "access plus 30 days"

#gzip
<FilesMatch "\.(js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>

does not work the same on all menu links which are identical in html structure, and not working properly. IE: It sends me to http://example.com/user/?view=pageName, but is loading the root HTML file content.

If I change this line

RewriteRule ^/user/([a-zA-Z])/?$ index.php?view=$1  [NC,L]

to

RewriteRule ^index\.php$ http://www.google.com  [NC,L]

I get sent to google as expected. So obviously I must be doing something wrong with the matching and replacing, but what am I doing wrong?
Thanks in advance.

Edit:
access.log and error.log are error free.

  • 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-22T21:14:15+00:00Added an answer on May 22, 2026 at 9:14 pm

    Fixed: Had to change HTML URL style to be used as such

    <a href="pageName">Page Name</a>
    

    Then in .htaccess

    RewriteEngine On
    RewriteOptions Inherit
    ReWriteBase /user/
    RewriteRule ^([a-zA-Z0-9]+)/?$ index.php?view=$1 [QSA,L]
    

    Also had to disable mod_cache.so from apache’s httpd.conf as it interfere with rewrite if there are any caches left behind. Hope this helps others to get clean urls working.

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

Sidebar

Related Questions

I have a PHP-based web app that I'm trying to apply Apache's mod_rewrite to.
I'm using PHP 4.3.9, Apache/2.0.52 I'm trying to get a login system working that
I am trying to get Apache::ASP running on OSX Lion Server. I have made
I've just set up mod python with apache and I'm trying to get a
I setup phpMyID on one of my machines, and I'm trying to get apache
I am trying to get a header that will work with Apache, IIS 6,
I am trying to get my ZEND application up on my apache server running
I'm trying to get perl running under on my Apache 2 macports install. I'm
What I'm trying to do: have pretty URLs in the format ' http://domain.tld/one/two/three ',
I am trying to get a Django app running on Apache with mod_wsgi. I

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.