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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T16:39:58+00:00 2026-05-30T16:39:58+00:00

in my website I have some pages structured in this way: www.mysite.com/x/y.php?query=z I wrote

  • 0

in my website I have some pages structured in this way:

http://www.mysite.com/x/y.php?query=z

I wrote a rule in my .htaccess file that is rewriting the pages in this way:

http://www.mysite.com/x-y/z

Now, since I am getting some SEO problems with these urls I would like my .htaccess file to 301 redirect both urls (www.mysite.com/x/y.php?query=z and http://www.mysite.com/x-y/z) to something like this:

http://www.mysite.com/x-y/z.html

I can I do this? I am posting you my .htaccess rule:

AuthType Basic 
RewriteEngine on
RewriteRule ([^/]+)-([^/]+)/([^/]+) $1/$2.php?titolo=$3 [L]

Thanks in advance!

Greetings from Italy


EDIT

Hi, as I wrote in my first post I need to 301 redirect some pages in my website. I have for example some pages like this:

http://www.mysite.com/dir/subdir/page.php?titolo=foo

which are now written like this (I am using the code I posted before):

http://www.mysite.com/dir/subdir-page/foo

Now I want to 301 redirect both http://www.mysite.com/dir/subdir/page.php?titolo=foo and http://www.mysite.com/dir/subdir-page/foo to this:

http://www.mysite.com/dir/subdir-page/foo.html

I put my htaccess in the “dir” folder. However the code you gave me did not work, I am sorry… since I am new to the htaccess I would appreciate very well your help.

Thanks in advance and best regards from Italy

  • 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-30T16:39:59+00:00Added an answer on May 30, 2026 at 4:39 pm

    Use this code:

    Options +FollowSymLinks -MultiViews
    # Turn mod_rewrite on
    RewriteEngine On
    RewriteBase /dir
    
    ## External 301 redirects
    # /dir/subdir-page/foo to /dir/subdir-page/foo.html
    RewriteCond %{QUERY_STRING} ^$
    RewriteCond %{REQUEST_URI} !\.html$ [NC]
    RewriteRule ^ %{REQUEST_URI}.html [R=302,L]
    
    # /dir/subdir/page.php?titolo=foo to /dir/subdir-page/foo.html
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+[^/]+/([^/]+)/([^.]+)\.php\?titolo=([^\s]+)\s [NC]
    RewriteRule ^ %1-%2/%3.html? [R=302,L,NC]
    
    ## Internal redirect
    # /dir/subdir-page/foo.html to /dir/subdir/page.php?titolo=foo
    RewriteRule ^([^-]+)-([^/]+)/([^.]+)\.html$ $1/$2.php?titolo=$3 [NC,L,QSA]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some pages on my public website that display charts generated by ASP.NET
I have a website that uses the AjaxControlToolkit. I'm making some parallel iPhone-friendly pages
So I have this PHP website that I am working on that using templates.
Bit of a strange question. I have a website which has some pages in
I have a website that use this style : /index.php?page=45&info=whatever&anotherparam=2 I plan to have
I have asp.net mvc website and in some pages i need a paging feature,
I am integrating PayPal in my website But I have some issues in it.
I have some problem with my cfml website. I have used the below code
I have some xml files that contain text, which are displayed on my website.
I have some problems with mod_rewrited at .httacess. We have created a website, the

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.