2

This is my .htaccess file,

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_URI} company
RewriteRule ^company/(.*)$ details.php?company_name=$1
RewriteRule ^(.*)\.php $1.php [L]

i have converted URL from,

www.myurl.com/detail.php?name-id

to

www.myurl.com/company/name-id

What i want is to remove special character (including # and +) from /name-id last part of url and replace with dash.

If anyone can help it wold be appreciable, Thank You in advance.

Mr. J
  • 320
  • 3
  • 14
  • 1
    That should be happening where you generate those links, not in a rewrite rule. – deceze Oct 02 '17 at 13:28
  • 1
    Your `RewriteCond` directive is entirely superfluous. And your last `RewriteRule` looks like _nonsense_ - what is that supposed to be doing? – MrWhite Oct 02 '17 at 14:23
  • Thank You for suggestion @MrWhite , i have removed last line from .htaccess, and i'm rookie to url-rewriting that is why it's not proper. – Mr. J Oct 03 '17 at 05:51
  • @deceze I know sir, but is it possible to remove special character from url by .htaccess ? – Mr. J Oct 03 '17 at 05:54
  • Yes, it is possible. (Note that `#` (unless it is URL encoded) will not appear in the URL that the _server_ sees anyway.) – MrWhite Oct 03 '17 at 10:49

0 Answers0