2

I want to make SEF url In that i want to remove file name also from the url. my site is in the core php, I manage to remove the extension from the url but didn't have idea that how to remove the whole file name from the url.

As i searched on google i got this code for the .htaccess

    RewriteCond %{REQUEST_FILENAME} !-f 
    RewriteCond %{REQUEST_FILENAME} !-d 
    RewriteRule ^(.*)$ index.php/$1 [L]

I have no idea that how to write header in php so it goes in related file but don't show the file name in url.

    <a href='http://mysite.com/edit/user/2/1'>click</a>

Now if i click on above link it does goto edit.php with url "mysite.com/edit/user/2/1",

so from this how can i remove file name that is "edit".

Thanks in advance

Satish
  • 1,012
  • 2
  • 15
  • 32

1 Answers1

1

Why? Isn't that a SEO friendly and user friendly URL? Why would you want to make it un-user fiendly? But anyway my guess is that you want /user to point to /edit by the looks of it:

RewriteRule ^/?user/*$ /edit.php?type=user&%{QUERY_STRING}

Though you will be making your site worse by using this and adding uneeded complexity to not only site maintenance but also user navigation.

Sammaye
  • 43,242
  • 7
  • 104
  • 146
  • I tired it but it didn't worked... my htaccess looks like as you said and the linke is "click" and the url i get is also the same that is http://108.166.92.199/edit.php?type=user – Satish Aug 10 '12 at 10:59
  • @Satish Wait, what are you trying to do? Your question state you are trying to take `edit` out of `edit/user/2/1` but your comment says otherwise...so what ARE you trying to do? Are you actually trying to change `edit.php?type=user` into `/edit/user` ? – Sammaye Aug 10 '12 at 11:05
  • No I just want to remove edit.. so final url become like "mysite.com/user/otherquery string" – Satish Aug 10 '12 at 11:19
  • @Satish Then change your HTML link to go: `108.166.92.199/user/blah` and you should see some magic happen. – Sammaye Aug 10 '12 at 11:24
  • I did it but page not found error.. and other thing is that i want to do it for all the files of the site i want to remove all the filename from url.. – Satish Aug 10 '12 at 11:32
  • @Satish I forgot all about this question, did you find the answer? – Sammaye Aug 17 '12 at 07:07
  • yes your answer is correct and I got the solution I was looking for.. Thanks for your time – Satish Aug 17 '12 at 10:07