0

I'm developing a website and I want to make like a profile page.

I was wondering if I could change from profile?name=BlaBla to profile/BlaBla.

How can I do this?

CTM Beast
  • 13
  • 2
  • which server are you using? You can do this with htaccess on apache server – Sudharshan Nair Jul 27 '18 at 11:42
  • I don't know what are you talking about because I'm a beginner.. I want to try it on localhost with xampp – CTM Beast Jul 27 '18 at 11:43
  • 1
    htaccess [rewrite](https://stackoverflow.com/a/16389034/715105) might help you here – JustBaron Jul 27 '18 at 11:44
  • 2
    Possible duplicate of [URL rewriting with PHP](https://stackoverflow.com/questions/16388959/url-rewriting-with-php) – iainn Jul 27 '18 at 11:44
  • 1
    Possible duplicate of [.htaccess RewriteRule to preserve GET URL parameters](https://stackoverflow.com/questions/4071155/htaccess-rewriterule-to-preserve-get-url-parameters) – Ole Haugset Jul 27 '18 at 11:45
  • I've tried to do this with htaccess rewrite but it's removing the design... – CTM Beast Jul 27 '18 at 11:45
  • Are you already removing the .php extension on your server? `profile?name=BlaBla`. And how is this related to javascript/jquery? – brombeer Jul 27 '18 at 11:58
  • 1
    If you're styling is not working you have an issue with the way you are referencing the style files. – Dave Jul 27 '18 at 11:58

3 Answers3

0

Try this

Options +FollowSymLinks
RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule ^profile/(.*)$ ./profile?name=$1    [L]
Sudharshan Nair
  • 1,152
  • 1
  • 10
  • 24
0

I do not have enough reputation to comment above. It seems that the CSS and other resources path are getting messed up when you are rewriting urls.

Please try and fix the css path by providing absolute urls. You could also use the HTML tag to set the base url to use relative paths for resources.

Sheikh Azad
  • 353
  • 2
  • 11
0

For This Process Better to use MVC Framework. Because in MVC already set Routing then from Route it's good to secure your data as well as fomating will be http://your-URL/controller/ID. I suggest you should use Codeigniter or Laravel Framework for this project. Or If you are generating API then use CodeIgniter, Laravel or Slim Framework for Routing.