doufei6456 2015-01-27 06:55
浏览 21

需要对.htaccess文件进行哪些更改才能查看实际的URL?

I've a website. Inside it's web root folder .htaccess file is present which contains the rules for hiding the actual URL and generating the pretty URLs.

But I want to see the actual URL i.e. how the request is going to the server, what parameters are being sent to which file on the server?

For this I don't know what changes needs to be done to the .htaccess file. Can someone please guide me in this regard?

For clear understanding of my issue please refer the code below present in .htaccess file :

######################################
## [PHPFOX_HEADER]
##
## @copyright       [PHPFOX_COPYRIGHT]
## @author          Raymond Benc
## @package         PhpFox
## @version         $Id: htaccess.txt 5866 2013-05-10 09:06:38Z Raymond_Benc $
######################################

# Options -Indexes
# Options -Multiviews

# Header unset Pragma
# FileETag None
# Header unset ETag

# URL Rewrite
<IfModule mod_rewrite.c>
    RewriteEngine On

    #
    #  Full path to your site
    #
    RewriteBase /

    # Rename Photo Names
    # RewriteRule ^file/pic/photo/([0-9]+)/([0-9]+)/([A-Za-z0-9]{32}+)\-(.*?)_([0-9]*?)\.(.*)$ file/pic/photo/$1/$2/$3_$5.$6
    # RewriteRule ^file/pic/photo/([0-9]+)/([0-9]+)/([A-Za-z0-9]{32}+)\-(.*?)\.(.*)$ file/pic/photo/$1/$2/$3.$5 

    # 301 redirect if missing www.
    #RewriteCond %{HTTP_HOST} !^www\.
    #RewriteRule ^(.*)$ http://www.% {HTTP_HOST}/$1 [R=301,L]

    # 301 redirect if missing trailing slash
    #RewriteCond %{REQUEST_FILENAME} !-f
    #RewriteCond %{REQUEST_FILENAME} !-d
    #RewriteRule [^/]$ %{REQUEST_URI}/ [R=301,L]

    #
    #  Rules
    #
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*) index.php?do=/$1

    # Image Access Protection
    # RewriteRule ^file/pic/photo/(.*)\.(.*)$ static/image.php?file=$1&ext=$2
</IfModule>

# Modify Headers
<IfModule mod_expires.c>
    ExpiresActive ON

    # Cache files
    <FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|swf|mp3|mp4)$">
        Header set Cache-Control "public"
        ExpiresDefault "access plus 2 months"
        Header unset Last-Modified
    </FilesMatch>

    # Cache JavaScript & CSS
    <FilesMatch "\.(js|css)$">
        Header set Cache-Control "public"
        ExpiresDefault "access plus 2 months"
        Header unset Last-Modified
    </FilesMatch>
</IfModule>

# Compress JavaScript & CSS
<IfModule mod_deflate.c>
    <FilesMatch "\.(js|css|php)$">
        SetOutputFilter DEFLATE
    </FilesMatch>
</IfModule>

Please help me in making only the necessary changes to get the Actual URLs. Though the website should function properly.

Thanks.

  • 写回答

2条回答 默认 最新

  • dplo59755 2015-01-27 07:11
    关注

    It's not your .htaccess file that makes friendly urls. It's your framework or CMS that does that. What .htaccess does, is converting friendly urls back to so-called query strings.

    It's always following pattern:

    RewriteRule from-what-users-see to-what-php-sees [flags]
    

    If you want to know what URL is your CMS/Framework seeing, use $_SERVER['REQUEST_URI']

    评论

报告相同问题?

悬赏问题

  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
  • ¥50 mac mini外接显示器 画质字体模糊