PHP Ferrari
PHP Ferrari

Reputation: 15666

Change URL using .htaccess

I want to change url for example http://localhost/mysite/index.php?page=about will become http://localhost/mysite/index/about

I also used RewriteRule ^index/(.*) /index.php?page=$1 and if I type http://localhost/mysite/index/about in URL bar then it redirects to http://localhost/xampp/splash.php, the page which shows that XAMPP is working fine.

One think more mod_rewrite is also enabled.

and if I use

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

# Rewrite all other URLs 
RewriteRule ^index/(.*)$ index.php?page=$1 [PT,L]

It shows the correct page but does not add style sheet and does not show images and also jQuery files. And Firebug shows numbers of different errors eg:

  1. $ is not defined
  2. syntax error
  3. jQuery is not defined
  4. $("#slider-two").movingBoxes is not a function

any guide....?

Upvotes: 0

Views: 969

Answers (1)

kushalbhaktajoshi
kushalbhaktajoshi

Reputation: 4688

Specify the full path of the files you call for scripts, images and stylesheets like

<link type="text/stylesheet" src="http://www.example.com/styles/main.css" />
<script type="text/javascript" src="http://www.example.com/scripts/jquery-min.js"></script>
<script type="text/javascript" src="http://www.example.com/scripts/jquery-slider.js"></script>

Upvotes: 1

Related Questions