.htaccess rewrite to convert forward slash (/) to dash (-)


I need a simple rule to rewrite

<ul><li>domainn.com/section/page</li> </ul>


<ul><li>domain.com/section-page.html</li> </ul>


RewriteRule ([^/]+)/([^/]+) $1-$2.html


try this rule:

RewriteEngine on Options +FollowSymlinks -MultiViews RewriteRule ^([^/]+)/([^/]+)/?$ /$1-$2.html [R,L]


RewriteEngine On

RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/?$ $1-$2.html [QSA,L]

If you would like to forward your users so the URL shows the change, place R=301 before QSA. R = Redirect, 301 = Permanent.


  • Rewrite .htaccess for https
  • Nginx rewrite and 2 parameters
  • Comparing a javascript variable with a part of a href
  • Gwt static resource from subfolders not found
  • Symfony2 behind ELB is redirecting to http instead of https
  • SSL Error: how to redirect https://www.domain.com to http://domain.com via .htaccess to avoid SSL er
  • how to use PHP to write the PDF?
  • Word Sizes and It's Indications
  • How to remove parts of URL by rewrite in htaccess
  • Smart URL with optional parameters?
  • Aspect advising other aspects
  • Can't get LogCat (Alcatel OneTouch Evolve)
  • Defining variable by logical subseting on time interval in data.table
  • htaccess settings for angularJS pushstate
  • Removing the .php file extension from the URL Request
  • Mod rewrite redirection to another domain if file not exist
  • Partial specialization of a class template in derived class affects base class
  • PyQt4 application on Windows is crashing on exit
  • sudo easy_install for SimpleITK not that easy
  • F#: In which memory area is the continuation stored: stack or heap?
  • If I am creating a simple client server application in IntelliJ, how should this work?
  • crash in __tcf_0
  • How to add closing tag for canvas in three js rendered Canvas?
  • Examples of how to a STS in .Net 4.5 using WCF
  • there is no graph with tensorboard
  • CSS bleed-through with cfinput type=“datefield”
  • R Split data.frame using a column that represents and on/off switch
  • Can I programmatically choose the Android layout folder?
  • Apache RewriteRule redirection with url encoded
  • Not able to aggregate on nested fields in elasticsearch
  • Unable to install Git-core+svn by MacPorts
  • Django simple Captcha “No module named fields” error
  • htaccess add www if not subdomain, if subdomain remove www
  • Could not find rake using whenever rails
  • htaccess rewriting URLs with multiple forward slashes
  • Proper way to use connect-multiparty with express.js?
  • Load html files in TinyMce
  • CSS Applying specific rule for a specific monitor resolution with only CSS is posible?
  • Can Visual Studio XAML designer handle font family names with spaces as a resource?
  • JaxB to read class hierarchy