简体   繁体   中英

Friendly URLS / URL Rewriting using .htaccess on godaddy shared server

I have been looking all over the place to find some code to work with my godaddy URL Rewriting, but no luck.

I am trying to make my website with Friendly URLS with .htaccess eg domain.com/company/buy/items.php?fatherID=23 ==> into ==> domain.com/23 I tried almost all codes and the best i got to is removing the .php

Sample Code:

Options +FollowSymLinks -MultiViews

Turn mod_rewrite on

RewriteEngine On

RewriteBase /

RewriteRule ^/([0-9]+)/?$ company/items.php?fatherID=$1 [NC,L]

Does anyone have any idea with some simple code? I am on godaddys shared Linux server.

I tried to redurect 404 error codes with: ErrorDocument 404 /domain.com/home/404error.php but this also did not work.

Is there something I am missing?

Try this , it should be work

<IfModule mod_rewrite.c>
 Options -MultiViews      
  RewriteEngine on
  RewriteBase /
  RewriteRule ^([0-9]+)$ company/items.php?fatherID=$1 [L]
</IfModule>

Godaddy is a special case. It will work surely.

 DirectoryIndex index.php
 AddDefaultCharset utf-8

 RewriteEngine on
 Options +FollowSymlinks -MultiViews -Indexes   

 RewriteBase /
 RewriteRule ^/([0-9]+)/?$ company/items.php?fatherID=$1 [NC,L]

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