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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T15:47:40+00:00 2026-05-30T15:47:40+00:00

I am here again with the query of re-writing URL :(. I am using

  • 0

I am here again with the query of re-writing URL :(.
I am using htaccess for re-writing, below is my htaccess code:

RewriteEngine On
RewriteBase /

RewriteCond %{ENV:REDIRECT_STATUS} 200
RewriteRule ^ - [L]

RewriteCond %{REQUEST_URI} !-f 
RewriteCond %{REQUEST_URI} !\.\w+$
RewriteCond %{REQUEST_URI} !/$ 
RewriteRule (.*) /$1/ [R,L]

RewriteCond %{REQUEST_URI} ^/([\w\d-]+)/$ [NC]
RewriteRule ^ /?file_name=%1 [L,QSA]

RewriteCond %{QUERY_STRING} !^$
RewriteCond %{QUERY_STRING} (?:(.*)&)?file_name=([\w\d-]+)(.*) [NC]
RewriteRule ^ %2/?%1%3 [L,R]

Before asking my queries let me give you short explanation about how above code is working. I have a URL like http://www.mysite.com/ (for index) and other pages could be executed by using a parameter called file_name=page_name like http://www.mysite.com/?file_name=my_blog. My htaccess is helping me to exclude the file_name parameter and make a new URL like http://www.mysite.com/my_blog/.

Now I do have a query:

  1. Right now there is already a parameter file_name and now I want to give extra parameters like http://www.mysite.com/?file_name=my_blog&blog_alias=welcome-to-new-generation and wanted this to look like http://www.mysite.com/my_blog/welcome-to-new-generation/. So if I add any number of parameter there parameter name should be removed and only parameter value comes with slash.
    Please note: Parameter name could be anything.

Please please please help.

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

    This is a very interesting problem that requires recursive implementation of mod_rewrite rules. Put this code in your .htaccess:

    Update II As per further comments, redirects /?file_name=my_blog&blog_alias=welcome-to-new-generation&foo=bar&n=v URI to /file_name+my_blog/blog_alias+welcome-to-new-generation/foo+bar/n+v

    Options +FollowSymLinks -MultiViews
    # Turn mod_rewrite on
    RewriteEngine On
    RewriteBase /
    
    # forwards ?file_name=my_blog&blog_alias=welcome-to-new-generation to
    # /file_name=my_blog&blog_alias=welcome-to-new-generation
    RewriteCond %{THE_REQUEST} ^[A-Z]{3,}\s/+\?([^\s]+)\s [NC]
    RewriteRule ^$ %1? [L]
    
    # redirects /file_name=my_blog&blog_alias=welcome-to-new-generation&foo=bar&n=v
    # to /file_name+my_blog/blog_alias+welcome-to-new-generation/fo+barn+/v    
    RewriteRule ^(.*/)?([^=]+)=([^&]+)&(.*)$ $1$2+$3/$4 [L]
    RewriteRule ^(.*/)?([^=]+)=(.*)$ $1$2+$3 [L,R]
    
    # internal forward from /file_name+my_blog/blog_alias+welcome-to-new-generation to
    # /?file_name=my_blog&blog_alias=welcome-to-new-generation
    RewriteRule ^([^\+]+)\+([^/]+)/(.*)$ $3?$1=$2 [L,QSA]
    RewriteRule ^([^\+]+)\+([^/]+)/?$ /?$1=$2 [L,QSA]
    

    Once you’re sure it is working change R to R=301

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

Sidebar

Related Questions

Rookie C++ Programmer here again I'm using VC++ VS2008 and making an attempt at
Alright, here I am again trying to write code from scratch and I can't
Here we go again , searched and tried myself but none of the online
So, I seem to ask hard questions but here I go again. I have
Here's a question that comes up again and again in C++ class implementation. I'm
I followed this guide here perfectly and have gone through it again but when
Hello again everyone, This time I have a problem with Intent & Extras. here's
I am again posting the same question. Please help me in this problem. Here
Edit: You can get the full source here: http://pastebin.com/m26693 Edit again: I added some
the guy that asks weird things, here, again I see that they use different

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.