简体   繁体   中英

How to edit the htaccess file

I wrote these in the .htaccess file:

DirectoryIndex index.php   
RewriteEngine On
RewriteRule ^user/([^/]*)(/?)+$ profile.php?id=$1 [L]

But when I'm going to site.com/user/nickname , all content is loading relating user folder. That is my style.css file, which located in root folder is not loading. I don't want to edit all my code.

Example: I have wrote these to all my code: <img src="uploads/some_image.jpg"> . I don't want to change this to <img src="/uploads/some_image.jpg"> .

I don't want to change this to <img src="/uploads/some_image.jpg">.

But that's what you should do. As an alternative you could use the <base> tag <base href="/" /> within <head> . I would not advise you to solve this with more rewrite rules.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM